File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Null and Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Null and """ Watch "Null and """ New topic

Null and ""

Art DeSeve

Joined: Nov 15, 2000
Posts: 5
Are null and "" the same thing? I thought they were but now I am wondering.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
They most certainly are NOT the same thing.
null is a special literal value used to indicate an un-initialized reference. Instance variables are initialized to null. If you try to perform an operation on an object reference that has the null value you get a NullPointerException.
"" is a String object that has zero characters it it.

I agree. Here's the link:
subject: Null and ""
It's not a secret anymore!