正在加载图片...
protected int b3=3; private int b4=4; int getB40{return b4; } class A extends B( int a=5; int Sum({return b1 b2+b3+getB40+1;} public class ClassInheritance{ public static void main(String[]args){ B bb=new BO; System.out.println("B:"+bb.b1+""+bb.b2+""+bb.b3+"" bb.getB4(); A aa new AO; System.out.println("A:"+aa.b1+""+aa.b2 +""+aa.b3+""+ aa.getB40+""+aa.a+""+aa.Sum(); 》 5)以下程序段的输出结果为 class A( int x=10; int getNxO{ return 10*x;protected int b3 = 3; private int b4 = 4; int getB4() { return b4; } } class A extends B{ int a = 5; int Sum() { return b1 + b2 + b3 + getB4() + 1; } } public class ClassInheritance { public static void main(String[] args) { B bb = new B(); System.out.println("B:" + bb.b1 + " " + bb.b2 + " " + bb.b3 + " " + bb.getB4()); A aa = new A(); System.out.println("A:" + aa.b1 + " " + aa.b2 +" " + aa.b3 + " " + aa.getB4() + " " + aa.a + " " + aa.Sum()); }} 5)以下程序段的输出结果为 。 class A{ int x=10; int getNx(){ return 10*x;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有