If I were to create a String in Java:
String example = "text";
what is the value of the variable example? At first I said that the value is: text, with no quotes, but now I am second guessing myself thinking that the value is: “text”, with quotes. Help!
The variable value is
textwith no quotes. The quotes are only here to specify that the provided data is a string and not a variable name.If you want to store
"text"in a variable, you’ll have to do :To be technically accurate, as Henry pointed out below, the actual value of the variable is a memory reference to a
Stringinstance containingtext.