public class Test_he {
class ss{
int r=8;
public void getR(){
System.out.println(r);
}
}
class sss extends ss{
int r=10;
public void getR(){
System.out.println(r);
}
}
public static void main(String[] args) throws ClassNotFoundException {
Test_he h=new Test_he();
ss a=h.new sss();
System.out.println(a.r);
a.getR();
}
}输出的结果为什么是8 10,而不是10 10?
class ss{
int r=8;
public void getR(){
System.out.println(r);
}
}
class sss extends ss{
int r=10;
public void getR(){
System.out.println(r);
}
}
public static void main(String[] args) throws ClassNotFoundException {
Test_he h=new Test_he();
ss a=h.new sss();
System.out.println(a.r);
a.getR();
}
}输出的结果为什么是8 10,而不是10 10?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货