aspose file tools*
The moose likes Beginning Java and the fly likes Instance Variable Initail Values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Instance Variable Initail Values" Watch "Instance Variable Initail Values" New topic
Author

Instance Variable Initail Values

Jenny Jha
Greenhorn

Joined: Feb 23, 2008
Posts: 1
Hi All,
as we know in Java all the instance variable are initialized to there default values and so on...
Now we can see at many places instance variable being given some default values for e.g.
protected Object myObject = null;

Now my question is the above mentioned way of programming is a good programming practice or it has some other meaning too.

Thanks

Jenny
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
As not all programmers can remember the default values, then explicitly assigning values makes the code easier to read.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
Don't get me started about those stupid light bulbs.
 
subject: Instance Variable Initail Values