class father{
String father="father";
public String get(){
return father;
}
public String getString(){
return get();
}
}
class child extends father{
String child ="child";
public String get(){
return child;
}
}
public class othertest { public static void main(String s[]) {
child c=new child();
System.out.println(c.get());
System.out.println(c.getString());
System.out.println(((father)c).get());
System.out.println(((father)c).getString());
}
}大家都来试试吧
String father="father";
public String get(){
return father;
}
public String getString(){
return get();
}
}
class child extends father{
String child ="child";
public String get(){
return child;
}
}
public class othertest { public static void main(String s[]) {
child c=new child();
System.out.println(c.get());
System.out.println(c.getString());
System.out.println(((father)c).get());
System.out.println(((father)c).getString());
}
}大家都来试试吧
解决方案 »
- System.exit(0); 这个语句会释放数据库的连接吗???
- 如何刷新canvas?
- 一个简单的重写问题 请帮忙一下
- 两个ArrayList对象变量,如何生成一个HashMap<String key,ArrayList list>对象变量,有些挑战。。
- 高薪急聘 (工作地点:杭州 美国)
- 几个非常基础的问题
- jvm的所有参数设置(摘录)
- 我以前只学过C,现在怎么转到JAVA,怎么起步??
- jsdkee1.2.1中启动deploytool时发生异常java.lang.NullPointException该怎么办?急
- tomcat+apache(sun solaris)如何配置
- 各位大虾:请问哪里有面向对象思想与道家哲学方面联系的文章呢,我对这个很感兴趣,不知怎么才能找到?
- 有关imageicon的问题 在线急等
child
child
child