Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Help Java N The null keyword

Related Tutorials


 
 

Share on Google+Share on Google+

The null keyword

Advertisement
The null keyword in java programming language is a reserved word that is used to represent no value.

The null keyword

     

The null keyword in java programming language is a reserved word that is used to represent no value. Keywords are basically reserved words which have specific meaning relevant to a compiler.

Syntex:  Here is the syntax that displays how to declare and define null values in java programming language.

Integer a;

a = null;

String str;

if (str != null)

{

<statements>

}

Note: Here are some points that must be considered while declaring and assigning a value to a variable.

  • Assigning a null value to a non-primitive type variable releases the object to which the variable previously referred.

  • Primitive data types such as byte, short, int, long, char, float, double, boolean cannot have a null type.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 27, 2009

Related Tutorials

Discuss: The null keyword  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com