I am confused regarding whether memory allocation in java occurs at run time or compile time.
For example:
class Test{
int a;
public Test(){
a=10;
}
};
// somewhere else
Test t = new Test();
Is a
allocated at run time or at compile time? If at compile time, how is it possible as java runs on a VM which directly takes compiled .class files?
Also:
when is
a
assigned the value10
?how does it work for reference variable
t
?
Thanks.