Hmmm... it turns out that the question number is meaningless in Mughal & Rasmussen's exam, as the quetions are reshuffled each time you run the program. With a little work though I found the original question, since the single line reproduced above is FALSE unless given a bit more context:
Which of the following statements concerning the value of a member variable are true, when no explicit assignments have been made?
- The value of an int is undetermined.
- The value of all numeric types is zero.
- The compiler is issued an error if the variable is used before it is initialized.
- The value of a String variable is "" (empty string).
- The value of all object variables will be null.
In this context, I'd take the last statement as a straightforward statement. "Object variable" seems to be an alternate way of saying "reference variable", a term used in the JLS. We often omit the
word "reference" when dealing with reference types if it's otherwise clear that we're dealing with some sort of Object, because Objects are
always dealt with via references in
Java. You don't seem to object to the statement about a "String variable" whose "value" is a blank
string, even though it's really a variable whose type is a reference to a String, whose value is a reference to a blank string. Since this sort of language quickly would become tedious, it's common usage to leave out all the "reference to" clauses most of the time, unless it's necessary to remind someone what's really going on. (As often happens in this forum, which is why a lot of us
here actually will take pains to say "reference to x" instead of "x" in many cases.)
So, an "object variable" is just a reference variable, and if it's an uninitialized class variable, then it is indeed null, so the statement is true. Does that make sense?