【Java开源代码栏目提醒】:网学会员--在 Java开源代码编辑为广大网友搜集整理了:inheritConstruct_4.java绩等信息,祝愿广大网友取得需要的信息,参考学习。
public class inheritConstruct_4 extends hasConstructor{
protected int x = 200; //隐藏父类中的同名变量
public int getSuperX(){
return super.x; //使用父类中的变量x
}
public int getX(){
return x; //使用本类中的变量x
}
public static void main(String args[]){
inheritConstruct_4 oa = new inheritConstruct_4();
System.out.println( "oa.getSuperX() = " + oa.getSuperX() );
System.out.println( "oa.getX() = " + oa.getX() );
}
}
上一篇:
inheritConstruct_3.java
下一篇:
4种小菜缓解孕妈咪不适