Friday, December 9, 2011

Class Definition » null

The null Keyword
You can test if a reference variable is null by using the == operator. For instance.
public class MainClass {

  public static void main(String[] args) {
    String book = null;
    
    if (book == null) {
        book = new String();
    }
  }

}
 
http://www.java2s.com/Tutorial/Java/0100__Class-Definition
/Catalog0100__Class-Definition.htm
 

No comments:

Post a Comment