What is NULL?
Please answer if know it exactly in java Perspective.

Recommended Answers

All 4 Replies

Which Null you are looking for, in Java, in Sql, in C++.

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

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..

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.