本帖最后由 Sasson 于 2013-11-7 21:56 编辑
class Fu{
int num = 4;
Fu(){
num = 5;
}
}
class Zi extends Fu{
int num = 6;
public void method(){
int num = 7;
System.out.println(num);
}
}
class Test{
public static void main(String[] args) {
Zi z = new Zi();
z.method();
}
}
---------------------------------------------------------------------------------------------------------------
问会有什么结果,如果想输出6怎么改,如果想输出5怎么做,能否输出4? |
|