1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
fenix001 [56]
3 years ago
8

If x is a string, then x = new String("OH"); and x = "OH"; will accomplish the same thing. Group of answer choices True False

Chemistry
2 answers:
Vinvika [58]3 years ago
5 0

Answer:

True is the correct answer to the above question.

Explanation:

  • If x is a string then it can be assigned by the help of two ways in java:
  • By the help of constructor:- When we write " x = new String("OH");", then it will create a pass a string "OH" into the constructor. It is because the String is a class in java and x is an object created by the constructor of the String class.
  • With the help of assigning: The "x= OH", which assigns the value of x which is an object of String class it can also use the constructor to initialize the "OH" string on the class.
  • The above question states the two scenarios which are defined above. Hence the question statement is true.
Akimi4 [234]3 years ago
5 0

Answer:

"True" is the correct answer to this question.

Explanation:

The program to the given question as follows:

Program:

public class data //defining class

{

  public static void main (String [] aw)//defining the main method

  {

String x="OH"; //defining string variable x and assign value

System.out.println("assign value: "+x); //print value

x = new String("OH"); //defining instance variable and assign value

System.out.println("assign value by creating instance: "+x); //print value

  }

}

Output:

assign value: OH

assign value by creating instance: OH

Explanation of the program:

In the above java program, a class data is defined, inside the class the main method is declared, In this main method a string variable "x" is defined that holds a value "OH", then we the print function to print this variable value.

In the next line, An instance of variable x is created, which holds a value "OH" in its parameter. In this question, both are correct because both hold the same value.

You might be interested in
In UV region measurements, the üsed cell must be Oa. Plastic cell O b. KBr cell C. Fused silica cell d. Glass cell​
Vaselesa [24]

Answer:

i think it is d Glass cell

Explanation:

4 0
2 years ago
The rate of product formation by an enzyme-catalyzed reaction would be increased by
EastWind [94]
The rate of product formation by an enzyme-catalyzed reaction would be increased by temperature (until it reaches optimim temperature)
5 0
3 years ago
(台)what is the answer ​
alukav5142 [94]

Answer:

google chrome

Explanation:

it is the home button on the top left corner

3 0
2 years ago
Why do solids exist ?
lubasha [3.4K]

Answer:

A solid's particles are packed closely together. The forces between the particles are strong enough that the particles cannot move freely; they can only vibrate. As a result, a solid has a stable, definite shape and a definite volume. Solids can only change shape under force, as when broken or cut.

7 0
2 years ago
Read 2 more answers
Determine whether the given compound name or formula contains a polyatomic ion. N H 4 C l Choose... Magnesium sulfate Choose...
Morgarella [4.7K]

Answer:

NH₄Cl, Magnesium sulfate, KCN

Explanation:

Determine whether the given compound name or formula contains a polyatomic ion.

  • NH₄Cl. YES. It contains the polyatomic ion ammonium NH₄⁺.
  • Magnesium sulfate. YES.  It contains the polyatomic ion sulfate SO₄²⁻.
  • Sodium phosphide Na₃P. NO.
  • SO₃. NO.
  • Calcium hydroxide Ca(OH)₂. NO.
  • KCN. YES. It contains the polyatomic ion cyanide CN⁻.
4 0
2 years ago
Other questions:
  • How can a charged atom (an ion) attract a neutral atom? 1. the charged atom can hit the neutral atom and make it positively char
    14·1 answer
  • Facts about the outer core
    10·1 answer
  • How many moles are in 1.84x10^24 formula units of CaCl2, calcium chloride?
    9·1 answer
  • Which statement identifies a characteristic of a scientific theory?
    8·1 answer
  • There are many diverse species of plants and animals
    14·1 answer
  • How many moles are there in 140.g of potassium bromid
    8·1 answer
  • Why alkanes undergo substitution reaction?
    12·1 answer
  • For this question, you will need to submit a picture of your work in order to receive credit for the proper calculation.
    15·2 answers
  • PLS!! I really need help since I don´t understand this
    10·2 answers
  • All acid base indicators ____
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!