class super { &e

题目

class super {   public int getLength() {return 4;}    }   public class Sub extends Super {   public long getLength() {return 5;}   public static void main (Stringargs) {   super sooper = new Super ();  Sub sub = new Sub();   System.out.printIn(   sooper.getLength()+ “,” + sub.getLength() };   }   What is the output?() 

  • A、 4, 4
  • B、 4, 5
  • C、 5, 4
  • D、 5, 5
  • E、 The code will not compile.
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

The lower-level classes (known as subclasses or derived classes) ( ) state and behavior from the higher-level class (known as a super class or base class).

A.request B.inherit C.invoke D.accept


正确答案:B

第2题:

class A {  A() { }  }  class B extends A {  }  Which two statements are true?()

  • A、 Class B’s constructor is public.
  • B、 Class B’s constructor has no arguments.
  • C、 Class B’s constructor includes a call to this().
  • D、 Class B’s constructor includes a call to super().

正确答案:B,D

第3题:

Click the Exhibit button. What two must the programmer do to correct the compilation errors? ()

A.insert a call to this() in the Car constructor

B.insert a call to this() in the MeGo constructor

C.insert a call to super() in the MeGo constructor

D.insert a call to super(vin) in the MeGo constructor

E.change the wheelCount variable in Car to protected

F.change line 3 in the MeGo class to super.wheelCount = 3;


参考答案:D, E

第4题:

class super {  public int getLength()  {return 4;}  }  public class Sub extends Super {  public long getLength() {return 5;}  public static void main (String[]args)  {  super sooper = new Super ();  Sub sub = new Sub();  System.out.printIn(  sooper.getLength()+ “,” + sub.getLength()   };  }  What is the output?()  

  • A、 4, 4
  • B、 4, 5
  • C、 5, 4
  • D、 5, 5
  • E、 The code will not compile.

正确答案:E

第5题:

Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }  

  • A、The code will fail to compile.
  • B、The constructor in a that takes an int as an argument will never be called as a result of constructing an     object of class b or c.
  • C、Class c has three constructors.
  • D、Objects of class b cannot be constructed.
  • E、At most one of the constructors of each class is called as a result of constructing an object of class c.

正确答案:B,C

第6题:

The lower-level classes(known as subclasses or derived classes) ( )state andbehavior from the higher-level class(known as a super class or base class).

A.request
B.inherit
C.invoke
D.accept

答案:B
解析:
低层的类(也称子类或派生类)从高层类(也称为超类或基类)中继承了状态和行为。

第7题:

class Super {  public int getLenght( ) { return 4; }  }  public class Sub extends Super {  public long getLenght( ) { return 5; }  public static void main(String[] args) {  Super sooper = new Super( );  Sub sub = new Sub( );  System.out.println(  sooper.getLenght( ) + “,” + sub.getLenght( ) );  }  } What is the output?()

  • A、 Just after line 13.
  • B、 Just after line 14.
  • C、 Just after line 15.
  • D、 Just after line 16 (that is, as the method returns).

正确答案:C

第8题:

已知:Manager extends Employee观察:public Manager(String n,double s,int year,int month,int day) { super(n,s,year,month,day); bonus=0; }其中super是 ( )

A.Object类

B.Manager类

C.Employee类

D.Class类


正确答案:C
解析:本题中有extends这说明是继承,子类Manager继承父类Employee,使用变量super能够实现对父类成员的访问,所以本题中super指的是父类Employee。

第9题:

class super {   public float getNum() {return 3.0f;}   }   public class Sub extends Super {   }   Which method, placed at line 6, will cause a compiler error?()

  • A、 Public float getNum() {return 4.0f; }
  • B、 Public void getNum (){}
  • C、 Public void getNum (double d){}
  • D、 Public double getNum (float d) {retrun 4.0f; }

正确答案:B

第10题:

Which two login-class permissions could permit a user to view the system hierarchy of the active configuration?()

  • A、system permission
  • B、view-configuration permission
  • C、network permission
  • D、super-user permission

正确答案:A,B

更多相关问题