I got this question right, and I understand the order in which each statement are executed. I've made some modification and I don't understand the following :
Code: Select all
public class InitTest{
static
{
// System.out.println(s1); < Does not compile because S1 hasn't been initialized
s1 = sM1("c");
// System.out.println(s1); < Does not compile because S1 hasn't been initialized
}
static String s1 = sM1("a");
{
s1 = sM1("b");
}
public static void main(String args[]){
InitTest it = new InitTest();
}
private static String sM1(String s){
System.out.println(s); return s;
}
}
Thanks
