If s is a String, and s = “no”; is performed, then s

If s is a String, and s = “no”; is performed, then s

a)       stores the String “no”
b)       references the memory location where “no” is stored
c)       stores the characters ‘n’, ‘o’
d)       stores an int value that represents the two characters
e)       stores the character ‘n’ and a reference to the memory location where the next character, ‘o’ is stored

Answer:  b.

Explanation:  Strings are objects and all objects in Java are referenced by the variable declared to be an object.  That is, the variable represents the memory location where the object is stored.  So, s does not directly store “no” or ‘n’, ‘o’, but instead stores a memory location where “no” is stored.


Enhancing Classes

Learn More Multiple Choice Question :