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
Write an equation that shows the formation of a lithium ion from a neutral lithium atom
AleksAgata [21]
Li + e- ===> Li+
it looses its valence electron to form a uni-positive ion
8 0
3 years ago
Read 2 more answers
The curiosity is important in the progress of science because it
nordsb [41]
It it important because it makes people wonder how things work and are made which makes it so they want to move forward with experiments <span />
3 0
3 years ago
Read 2 more answers
Can someone help me with this
sergejj [24]

Answer: 5. Positive

6. Negative

9. Oxygen carbon hydrogen nitrogen

Explanation:

7 0
2 years ago
What is the electron configuration of an element with atomic number 15?
Ghella [55]
1s to the second power, 2s to the second power, 2p to the 6th power, 3s to the second power and 3p to the third power.
4 0
3 years ago
PLEASE HELP!!!!!!!!!
andreev551 [17]

The average atomic mass of the imaginary element : 47.255 amu

<h3>Further explanation  </h3>

The elements in nature have several types of isotopes  

Isotopes are elements that have the same Atomic Number (Proton)  

Atomic mass is the average atomic mass of all its isotopes  

Mass atom X = mass isotope 1 . % + mass isotope 2.% ..

isotope E-47 47.011 amu, 87.34%

isotope E-48 48.008 amu, 6.895

isotope E-49 50.009 amu, 5.77%

The average atomic mass :

\tt avg~mass=0.8734\times 47.011+0.06895\times 48.008+0.0577\times 50.009\\\\avg~mass=41.059+3.310+2.886\\\\avg~mass=47.255~amu

5 0
2 years ago
Other questions:
  • What does a graph with no trend indicate about the variables?
    5·1 answer
  • How many atoms of chromium are in 0.86 mol of potassium chromate (K2CrO4)?
    15·1 answer
  • What element is represented by the chemical symbol V​
    5·2 answers
  • What is the reason why bubbling occurs when vinegar is mixed with baking soda?
    13·1 answer
  • If 32.0g cac2 are consumed in this reaction, how many moles of h2o are needed
    5·1 answer
  • Fill in the blank
    11·1 answer
  • Follow me and get five thanks​
    10·1 answer
  • What is heterogenous mixture​
    15·2 answers
  • Pleaseeee help me
    11·1 answer
  • Which of the following sets of quantum numbers refers to a 4p orbital
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!