• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object references that are not initialized  RSS feed

 
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers ,
I am confused here

Is this true ?

Object references that are not initialized
explicitly will have their value set to null always


 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but only if they are fields; if they are local variables they may cause a compiler error.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but only if they are fields;
Ritchie fields are always initialised to Zero value if not initialized,not Null!
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joywish Man wrote:
Yes, but only if they are fields;
Ritchie fields are always initialised to Zero value if not initialized,not Null!

We're talking about object references, not numeric primitives. Zero is not a valid value for an obect reference.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!