aspose file tools
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: 12912
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.

Don't get me started about those stupid light bulbs.
subject: Null and ""