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 reagents necessary to convert cyclohexane into 1,3-cylohexadiene: notice that the starting material has no leaving grou
Vinvika [58]
<span>1,3-cylohexadiene i synthesized starting from cyclohexane in following 4 steps.

1) Free Radical Substitution Rxn:
 Halogenation of cyclohexane in the presence of UV yield chlorocyclohexane.

2) Elimination Rxn: Dehydrohalogenation of chlorocyclohexane yields cyclohexene.

3) Halogenation of Cyclohexene (Electrophillic Addition Rxn) gives 1,2-dihalocyclohexane.

4) Elemination Rxn: When dibromocyclohexane is treated with KOH and heated it gives 1,3-cyclohexadiene as shown below,</span>

4 0
2 years ago
A student wanted to investigate the effect of light on the growth of
timofeeve [1]

Answer:

D.phototropism

Explanation:

Phototropism is a type of tropism in which a plant or plant part responds to light. According to this question, a student wanted to investigate the effect of light on the growth of cress seedlings. The student used three different pots for the experiment.

Pot 1 was placed with light from above. Pot 2 was placed in a cupboard with no light. Pot 3 was placed in a window with light from one direction only. However, the image attached to this question shows that the plants in the different pots face different directions in response to light, which depicts phototropism

5 0
2 years ago
What would happen to the volume of the container if the pressure is increased by a factor of 2​
telo118 [61]

Answer:

volume of the container will decreases if pressure increases.

Explanation:

According to Boyle's law:

Pressure is inversely proportional to volume which means if pressure of a gas increases the volume of the gas will decreases as gas molecules will collide and come closer forcefully so volume will decreases. And its formula for determining volume and pressure is:

<em>PV=nRT</em>

where "R" is a ideal gas constant

"T" is temperature and

"n" is number of particles given in moles while "V" is volume and "P" is pressure.

8 0
2 years ago
CH3-CHCl-CH2-CH2-CH2CHCl-CH3 +concentrated KCN
Phantasy [73]
Is this chemistry or something else?
8 0
3 years ago
Read 2 more answers
Any two difference between short sightedness and long sightednes​
SSSSS [86.1K]

Explanation:

tala it is also called myopia lekhnu hai

Äni Arko MA it is also called hypermetropia .

3 0
2 years ago
Other questions:
  • 1. ancient plants and animals animals 2. consumers transpiration 3. water loss plants 4. relationship of organisms to their envi
    5·1 answer
  • The rate of disappearance of HBr in the gas phase reaction 2 HBr(g) → H2(g) + Br2(g) is 0.140 M s-1 at 150°C. The rate of appear
    11·1 answer
  • What is the chemical name and formula of a compound that has one carbon atom and four chlorine atoms?
    12·2 answers
  • Aluminum metal reacts with dilute sulfuric acid to produce aluminum sulfate and hydrogen gas. what mass of aluminum will react w
    10·1 answer
  • Which occurs whenever valence electrons are shared or transferred between atoms
    15·1 answer
  • The______of water molecules and the hydrogen bonds between water molecules explain most of water's life-supporting properties.Th
    7·2 answers
  • Calcium oxide reacts with water in a combination reaction to produce calcium hydroxide: CaO (s) H 2O (l) Ca(OH) 2 (s) In a parti
    14·1 answer
  • How many moles of hydrogen are in a 14 gram sample of propane gas?
    6·1 answer
  • How many moles of ions would you expect in an aqueous solution containing one mole of chromium(III) chloride? Hint: write out th
    9·1 answer
  • Why doesn't the air pressure crush this tiny<br> flower?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!