本帖最后由 hbk000 于 2015-4-5 18:02 编辑
public class SuperDemo {
public static void main(String[] args) {
Fu f = new Zi();
}
}
class Fu {
int i = 4;
Fu() {
run();
show();
}
void show() {
System.out.println("Fu_test" + i);
}
void run() {
System.out.println("Fu_test" + i);
}
}
class Zi extends Fu {
int j = 7;
Zi() {
super();
show();
}
void show() {
System.out.println("Zi_test" + "8" + j);
}
}
结果是:
//Fu_test4
//Zi_test80
//Zi_test87
为什么第二个结果那边j只声明了,没有被赋值?
|