class Super
{
{
new Sub();
}
Super() {
System.
out.
println("Super constructor"); this.printThree();
}
protected void printThree() {
System.
out.
println("Super's printThree"); }
}
class Sub extends Super
{
int three = this.initThree();
Sub() {
this.printThree();
}
private int initThree() {
System.
out.
println("Sub's initThree"); return 3;
}
protected void printThree() {
System.
out.
println("Sub's printThree: " + this.
three); }
}
Y2xhc3MgU3VwZXIKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJbmV3IFN1YigpOwoJfQoJCglTdXBlcigpIHsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIlN1cGVyIGNvbnN0cnVjdG9yIik7CgkJdGhpcy5wcmludFRocmVlKCk7Cgl9CgkKCXByb3RlY3RlZCB2b2lkIHByaW50VGhyZWUoKSB7CgkJU3lzdGVtLm91dC5wcmludGxuKCJTdXBlcidzIHByaW50VGhyZWUiKTsKCX0KfQpjbGFzcyBTdWIgZXh0ZW5kcyBTdXBlcgp7CglpbnQgdGhyZWUgPSB0aGlzLmluaXRUaHJlZSgpOwoJCglTdWIoKSB7CgkJdGhpcy5wcmludFRocmVlKCk7Cgl9CgkKCXByaXZhdGUgaW50IGluaXRUaHJlZSgpIHsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIlN1YidzIGluaXRUaHJlZSIpOwoJCXJldHVybiAzOwoJfQoJCglwcm90ZWN0ZWQgdm9pZCBwcmludFRocmVlKCkgewoJCVN5c3RlbS5vdXQucHJpbnRsbigiU3ViJ3MgcHJpbnRUaHJlZTogIiArIHRoaXMudGhyZWUpOwoJfQp9