code:
__________________________________________________
Question 5
class D {
{System.out.print("1");}
static {System.out.print("2");}
D() {System.out.print("3");}
D(
String s) {System.out.print("4");}
}
class E extends D {
{System.out.print("5");}
static {System.out.print("6");}
E() {System.out.print("7");this("e");}
E(String s) {System.out.print("8");}
}
class F {
public static void main(String[] args) {
new E();
}
}
compiler error
__________________________________________________
Question 6
class Q {
int i = 1;
{System.out.print("1");}
static {System.out.print("2");}
Q() {System.out.print("3");}
Q(int x) {System.out.print("4");}
}
class R extends Q {
int j = 2;
{System.out.print("5");}
static {System.out.print("6");}
R() {super(j);System.out.print("7");}
}
class S {
public static void main(String[] args) {
new R();
}
}
compiler error
__________________________________________________
I've seen no problem with Q5 - compiler could see that |this| stands on the second place. But in Q6 compiler doesn't know that |j| can't reached before R() construction. Why compiler error???