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
Identify the type of reaction shown by this chemical equation:<br>2AI + 6HCI - 2AlCl3 + 3H2​
ArbitrLikvidat [17]

Answer:

Single displacement reaction

Explanation:

2AI + 6HCI —> 2AlCl3 + 3H2

From the above reaction, we see clearly that Al displaces H from HCl. This is clearly a single displacement reaction.

5 0
3 years ago
Why do Christians call Jesus "the Christ”? Christ comes from the Greek word for Messiah. Christ comes from the Greek word for sa
Readme [11.4K]

Answer:

D

Explanation:

7 0
4 years ago
Read 2 more answers
How is Earth's surface most likely to change in a cold place that experiences rainfall?
Ghella [55]

Answer:

I think the answer would have to be D

7 0
3 years ago
The process is taking place at constant temperature and pressure. then which of the following is true?
Black_prince [1.1K]

Answer: ΔH=TΔS

Both ΔH and TΔS are temperature dependent, where ΔH = TΔS. Because ΔG = ΔH − TΔS, at this temperature ΔG = 0, indicating that the liquid and vapor phases are in equilibrium.

8 0
3 years ago
C. Tin(II) chloride is added to potassium permanganate solution in acidic condition
SVETLANKA909090 [29]

Answer:

lol

Explanation:

booooooooooooooooooooooooooo haha dhiw fif ejff h sj. ha ak

tin11 (mkd) ng kakaisawas

3 0
3 years ago
Other questions:
  • If 31.8 grams of LiCl are dissolved in 225 grams of water, what is the concentration of the solution in percent by mass? 
    5·2 answers
  • What is calculated by dividing mass volume
    14·1 answer
  • What animals use the earths magnetic field for navigation
    9·1 answer
  • Which of the following example(s) from everyday life are made possible by modern chemistry?
    14·2 answers
  • Which units express heat capacity
    14·2 answers
  • Jack tries to place magnets on the door of his refrigerator. He observes that the magnets don’t stick. He guesses that the door
    9·1 answer
  • You have two cups one is 6cm and other 10cm with no measurement and you have to pour 8cm of water into the 10cm cup using the tw
    8·1 answer
  • Use the References to access important values if needed for this question There are 12 eggs in a dozen. If a farmer's chickens p
    6·1 answer
  • Two students are trying to figure out the Calories per gram of potato chips. They burn part of the potato chip and feel the heat
    11·1 answer
  • Mr. Romeo wants to make a solution of NaOH. He measures out 85.66 grams and puts it into 7 liters.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!