Uh oh, didn't type fast enough - please allow me to ask a question on the previous code and comments:
Originally posted by Vanitha Sugumaran:
class Test {
static int x;
// other code here
so it prints the valur of x (has default value 0).
public static void main(String [] args) {
new Test();
}
}
I just read that the compiler complains about local variables that are not initialized. So here, because it's a static variable, it gets a default value of 0? Is this true of all static variables?
Thanks,
Pauline
[This message has been edited by Pauline McNamara (edited July 27, 2001).]