A
Alex Hunsley
A question on "correctness" of java code here....
I've been lead to believe that declaring class member variables without
explicitly initialising them (even to null or 0) is a Bad Thing(tm),
i.e. you should write:
private int count = 0;
and not just
private int count;
However, my understanding of the java spec is that it does specify that
member variables that aren't explicitly initialised get initialised to 0
or null. So can anyone give me a good reason to always explicitly
initialise member vars?
thanks
I've been lead to believe that declaring class member variables without
explicitly initialising them (even to null or 0) is a Bad Thing(tm),
i.e. you should write:
private int count = 0;
and not just
private int count;
However, my understanding of the java spec is that it does specify that
member variables that aren't explicitly initialised get initialised to 0
or null. So can anyone give me a good reason to always explicitly
initialise member vars?
thanks