Q1. Normally, after explicit initialization, the initialization block proceeds. this code source Does instance initialization occur after an initialization block?
Q2. When is the creation(memory upload) of the 'tmp' variable? Was it created before the initialization block?
class Test {
{
tmp = 2;
System.out.println(this.tmp);
}
float tmp = 1;
}
class Main {
public static void main(String[] args) {
Test t = new Test();
System.out.println("[Main] t.tmp : " + t.tmp);
t.tmp = 100;
System.out.println("[Main] t.tmp : " + t.tmp);
}
}
[Result] 2.0 [Main] t.tmp : 1.0 [Main] t.tmp : 100.0