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
sulfate = SO4 -2 phosphate = PO4 -3 hydroxide = OH- sodium hydroxide aNa(OH)2 bNa(OH)3 cNa2OH 4NaOH
blsea [12.9K]
4. NaOH
____________________________________
6 0
3 years ago
Which has more neutrons: Cobalt or Nickel?
Inessa05 [86]

Answer:

Because the most common form of Nickel is Ni-58 while the most common form of Cobalt is Co-59, this means that Cobalt (which is number 27 on the periodic table) has 27 protons and 32 neutrons. Therefore 1 less proton but 2 more neutrons and hence has a greater mass than Nickel.

Explanation:

7 0
2 years ago
What us energy stored in an object called​
Vikentia [17]

Answer:

potential energy

Explanation:

4 0
3 years ago
Read 2 more answers
An increase in blood co2 levels leads to __________.
tatiyna

Answer:

Respiratory Acidosis

Explanation:

4 0
3 years ago
Formal charge of Cl in CHCl3
Vsevolod [243]
FC(C) = 4 - 0.5*8 - 0 = 0) FC(Cl) = 7 - 0.5*2 - 6 = 0
6 0
3 years ago
Other questions:
  • Why is it important to inhale through your nose?
    14·1 answer
  • What has the study or fossils allowed scientists to do ?
    5·2 answers
  • Is helium a gas, liquid or solid at room temperature
    11·1 answer
  • If 1.785 g of ethanol (CHCHOH) is burned in a constant volume calorimeter causing a temperature increase of 4.32C, then what is
    15·1 answer
  • How many atoms are in 5 mole of water?<br> Steps
    9·1 answer
  • Which of the following reactions could be used to extract the lead from the lead nitrate?
    5·1 answer
  • Zinc + Hydrochloric acid — Zinc chloride + Hydrogen [Zn +2 HCI → ZnCl2 + H2] is an
    11·1 answer
  • What is the mass of chlorine in 3.9 x 1019 molecules of Cl2?
    9·1 answer
  • Which of the following is true for the percentage yield of a reaction?
    9·1 answer
  • 7. What assumption of the kinetic-molecular theory explains why a gas can expand to fill a container?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!