class A{
static int a=5;
int b=6;
void method(){
a++;
}
}
How the JVM processes a static variable, processes a static variable. eg...
A object1=new A();
A object2=new A();
Above the code will create two objects of class A in two different memory cells. Two instances will also be created variable b. What will happen for variable a. which object will contain the link for the static variable? and what happens when we update a static variable?
source
share