Suppose a reference variable of type String called myString has already been declared. Create an object of type String and assign it to the reference variable myString.

Suppose a reference variable of type String called myString has already been declared.  Create an object of type String and assign it to the reference variable myString.

LANGUAGE:  JAVA

CHALLENGE:

Suppose a reference variable of type String called myString has already been declared.
Create an object of type String and assign it to the reference variable myString.

SOLUTION:


String myString2 = new String();
myString = myString2;

Add comment