String a; Point b; A good answer might be:
| |
The null ValueA reference variable can hold information about the location of an object, but does not hold the object itself. This code... String a; Point b; ... declares two variables but does not construct any objects. The following constructs objects and puts references in the variables: a = "Elaine the fair." ; b = new Point( 23, 491 ); There is a special value called null that can be assigned to an object reference variable. The value null is a special value that means "no object." A reference variable is set to null when it is not referring to any object. In most programs, objects come and objects go, depending on the data and on what is being computed. (Think of a computer game, where monsters show up, and monsters get killed). A reference variable sometimes does and sometimes does not refer to an object. You need a way to say that a variable does not now refer to an object. You do this by assigning null to the variable. Inspect the following:
Variables | |
QUESTION 3:Click Here after you have answered the question |