计算机二级考试

解析:下列程序的输出结果是   class Father   int m

来源:网考网计算机二级 所有评论

【单选题】下列程序的输出结果是

  class Father

  int m.n;

  Father(int a,intB、

   m=a;

   n=b

  

  void show ( )

  System.out.println("m and n:"+m+" "+n);

  

  

  class Son extends Father

  int p;

  Son (int a,int b,intC、

   super(a,B、;

   p=c;

  

  void show()supur.show( );

  System.out.println("p:"+p);

  

  

  class Test

  public static void main (String args[ ])

   Son s:new Son(6,7,8);

   s.show( );

  

  
A.m and n:6 8

  p:7
B.m andn:6 7
  p:8
C.m and n:7 8
  p:6
D.m and n:8 7
  p:6

网考网参考答案:B
网考网解析:

解析:如果你希望访问一个覆盖方法的超类版本,可以通过super来做到这一点,本题中show()的超类版本在子类版本内被调用。 document.getElementById("warp").style.display="none"; document.getElementById("content").style.display="block"; 查看试题解析出处>>

相关推荐

发布评论 查看全部评论