Can we use instance variable before initializing?

class Variable2
{
int x;
public static void main(String[] alt)
{
Variable2 v=new Variable2();
System.out.println(v.x);
}
}
/*
Output:- 0(zero)
Explanation:- For instance variables JVM will provides default values and we are not required
to perform initialization explicitly.
*/

0 comments: