As mentioned in the below link Link
Static variables are initialized only once, at the start of the execution. These variables will be initialized first, before the initialization of any instance variables.
A single copy to be shared by all instances of the class.
But i am able to change the value of static variable
class Test {
static int a =10;
public static void main(String args[])
{
a=20;
System.out.println("rest of the code...");
Test1 t= new Test1();
t.m();
}
}
public class Test1 {
void m ()
{
System.out.println(Test.a);
}
}