• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference !!!  RSS feed

 
Ganesh Kumar
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends can anyone say me the difference between "Null" and "Empty"
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Empty is when you finish your can of Coke. Null is when you never had a can to begin with.
 
Shankar Narayana
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Take this example


In the first case for 'nullStr', no String object is been created, whereas for 'emptyStr' a String object is created with value being empty.
 
Ganesh Kumar
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Than you all!! friends
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Empty is when you finish your can of Coke. Null is when you never had a can to begin with.

And you can crush an empty can, while you cannot crush a can you don't have.

So, reusing Shankar's code :
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Null - Nothing is in real existence.

Empty - There is an Object in existence but with no content (empty). Like a Bus with no passengers, a cup with no juice etc.

HtH.
 
bala kris
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Null is like an empty but not actually an empty...

Hence, empty is like an empty only...

Have you got it ganesh...
 
Campbell Ritchie
Marshal
Posts: 56534
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Null is like an empty but not actually an empty?

Confusing.
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bala kris:
Null is like an empty but not actually an empty...

Hence, empty is like an empty only...

Have you got it ganesh...


I got It !


[ July 13, 2007: Message edited by: Sheethal Reddy ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!