go to previous page   go to home page   go to next page
String a;
Point  b;

Answer:


The null Value

A reference variable holds information about the location of an object. It does not hold the object itself. This code

String a;
Point  b;

declares two reference 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 );

null is a special value that means "no object." Set a reference variable to null when it is not referring to any object. Variables are often set to null when they are declared:

String a = null;
Point  b = null;

QUESTION 4:

(Thought Question:) Do you think that null can be assigned to reference variables of any type? Click here for a .