// 程序A
// 父类
class Parent {
int i = 1;
Parent() {
System.out.println(i);
int x = getValue();
System.out.println(x);
}
{i = 2;}
protected int getValue() {return i;}
}
// 子类
class Son extends Parent {
int j = 1;
Son() {j = 2;}
protected int getValue() {return j;}
}
class Test {
public static void main(String[] args) {
Son son = new Son();
System.out.println(son.getValue());
}
}
// 程序B
public class MagimaTest {
public static void main(String[] args) {
magimaFunction();
}
static MagimaTest st = new MagimaTest();
static {
System.out.println("1");
}
{
System.out.println("2");
}
MagimaTest() {
System.out.println("3");
System.out.println("a=" + a + ",b=" + b);
}
public static void magimaFunction() {
System.out.println("4");
}
int a = 110;
static int b = 112;
}