package javaapplication3;public class Main {
public static void main(String[] args) {
// TODO code application logic here
Inh2 i2 =new Inh2();
i2.print();
}
}
class Inh1{
public String s ="inh1";
public void print(){
System.out.println(s);
}
}
class Inh2 extends Inh1{
public String s ="inh2";
}
这一段代码输出的为什么是inh1而不是inh2阿
public static void main(String[] args) {
// TODO code application logic here
Inh2 i2 =new Inh2();
i2.print();
}
}
class Inh1{
public String s ="inh1";
public void print(){
System.out.println(s);
}
}
class Inh2 extends Inh1{
public String s ="inh2";
}
这一段代码输出的为什么是inh1而不是inh2阿
解决方案 »
- 如何对图片进行加密和解密操作
- 问个算法的问题
- 正则表达式:提取标签内信息。验证正确即散分
- 哪里又越界了?
- DispatchMapping[/myStruts] does not define a handler property
- 如何让Ant打包时把图片和一些设定文件打到Jar包中去?
- lomboz+jboss+eclipse配置j2ee项目提示Attribute "work-dir" must be declared for element type "web-app".
- ----关于JPanel的问题----
- 请问在JTABLE中如何将某几行设置成可以被选择的,其他几行设置成不能被选中的?
- 一个有关JAVA运行的问题,急急急!!!!,请高手解答,谢谢
- 怎样用java调用IE,然后再得到网页的源代码。
- 使用Spring管理事务不能回滚,在线等.急急急
跟进去就知道i2对象里肯定有两个s变量,一个标识为(Inh1)另一个标识为(Inh2)