4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by JamesCherrill
1

In Java you have variables and expressions that refer to objects or arrays.
"null" is the special value for those variables or expressions that have not been initialised to refer to a real object or array - it means that they refer to nothing.
eg
String s; declares a variable that refers to a String, but it has not been initialised, so its value is null

-1

Also you can define null value with String s =""; //declares a variable refers to String class,having initialised with null string..so its value is null..

You can also define like Strinf s1 = NULL; //It's also java's reserved keyword..

2

Also you can define null value with String s =""; //declares a variable refers to String class,having initialised with null string..so its value is null..

You can also define like Strinf s1 = NULL; //It's also java's reserved keyword..

Wrong, wrong, wrong.

"" is a String object containg a string of zero characters. The variable s refers to that object, it is NOT null.

Java is case sensitive, NULL is not the same as null

null is not a Java reserved keyword, it is a literal (J.L.S. 3.9)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.