1. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()  A、 public void getNum(){}B、 public void getNum(double d){}C、 public floa

题目

1. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()  

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

相似考题
更多“1. class Super {”相关问题
  • 第1题:

    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
    解析:
    低层的类(也称子类或派生类)从高层类(也称为超类或基类)中继承了状态和行为。

  • 第2题:

    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

  • 第3题:

    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

  • 第4题:

    class Super {  public int i = 0;  public Super(String text) {  i = 1; }  }  public class Sub extends Super {  public Sub(String text) {  i = 2;  }   public static void main(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()  

    • A、 0
    • B、 1
    • C、 2
    • D、 Compilation fails.

    正确答案:C

  • 第5题:

    1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   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

  • 第6题:

    多选题
    In the Java API documentation which sections are included in a class document?()
    A

    The description of the class and its purpose

    B

    A list of methods in its super class

    C

    A list of member variable

    D

    The class hierarchy


    正确答案: D,A
    解析: 类文档的内容主要是:类层次、类及用途描述、成员变量列表、构造方法列表、成员方法列表、从类层次上继承的方法列表、成员变量的详细说明、构造方法详细说明、成员方法详细说明。

  • 第7题:

    单选题
    class Super {  public int i = 0;  public Super(String text) {  i = 1; }  }  public class Sub extends Super {  public Sub(String text) {  i = 2;  }   public static void main(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()
    A

     0

    B

     1

    C

     2

    D

     Compilation fails.


    正确答案: B
    解析: This code is perfectly legal and the answer is C. 

  • 第8题:

    多选题
    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.


    正确答案: E,D
    解析: 暂无解析

  • 第9题:

    多选题
    1. class BigDog extends Dog {  2. // insert code here  3. }  分别插入到第 2 行,哪二项可以编译?()
    A

    BigDog() { super(); this(); }

    B

    BigDog() {  String name = Fido;  super();  }

    C

    BigDog() {  super();  String name = Fido;  }

    D

    private BigDog() {  super();}


    正确答案: D,A
    解析: 暂无解析

  • 第10题:

    单选题
    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.


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    class super (   public int I = 0;   public super (string text) (   I = 1   )   )     public class sub extends super (   public sub (string text) (   i= 2   )   public static void main (straing args) (  sub sub = new sub (“Hello”);   system.out. PrintIn(sub.i);  )   )   What is the result?()
    A

     Compilation will fail.

    B

     Compilation will succeed and the program will print “0”

    C

     Compilation will succeed and the program will print “1”

    D

     Compilation will succeed and the program will print “2”


    正确答案: D
    解析: 暂无解析

  • 第12题:

    单选题
    1. public class Employee {  2. String name;  3. double baseSalary;  4. Employee(String name, double baseSalary) {  5. this.name = name;  6. this.baseSalary = baseSalary;  7. }  8. }  And:  1. public class Salesperson extends Employee { 2. double commission;  3. public Salesperson(String name, double baseSalary,  4. double commission) {  5. // insert code here  6. } 7. }  Which code, inserted at line 7, completes the Salesperson constructor?()
    A

     this.commission = commission;

    B

     superb(); commission = commission;

    C

     this.commission = commission; superb();

    D

     super(name, baseSalary); this.commission = commission;

    E

     super(); this.commission = commission;

    F

     this.commission = commission; super(name, baseSalary);


    正确答案: C
    解析: 暂无解析

  • 第13题:

    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

  • 第14题:

    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

  • 第15题:

    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

  • 第16题:

    public class Employee{   private String name;   public Employee(String name){   this.name = name;  }   public void display(){   System.out.print(name);  }  }   public class Manager extends Employee{   private String department;   public Manager(String name,String department){   super(name);   this.department = department;  }   public void display(){   System.out.println( super.display()+”,”+department);  }   }   执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?() 

    • A、 smith,SALES
    • B、 null,SALES
    • C、 smith,null
    • D、 null,null

    正确答案:A

  • 第17题:

    In the Java API documentation which sections are included in a class document?()    

    • A、 The description of the class and its purpose
    • B、 A list of methods in its super class
    • C、 A list of member variable
    • D、 The class hierarchy

    正确答案:A,C,D

  • 第18题:

    单选题
    1. class A {  2. public String toString ()  {  3. return “4”;  4. }  5. }  6. class B extends A {  7. public String toString ()   {  8. return super.toString()  + “3”;  9. }  10. }  11. public class Test {  12.   public static void main(String[]args)  {  13.      System.out.printIn(new B());  14.      }  15. }    What is the result?()
    A

     Compilation succeeds and 4 is printed.

    B

     Compilation succeeds and 43 is printed.

    C

     An error on line 9 causes compilation to fail.

    D

     An error on line 14 causes compilation to fail.

    E

     Compilation succeeds but an exception is thrown at line 9.


    正确答案: A
    解析: 暂无解析

  • 第19题:

    单选题
    class Super {  public Integer getLenght() { return new Integer(4); } }  public class Sub extends Super {  public Long GetLenght() { return new Long(5); }  public static void main(String[] args) { Super sooper = new Super();  Sub sub = new Sub();  System.out.println(  sooper.getLenght().toString() + “,” +  sub.getLenght().toString() ); } }  What is the output?()
    A

     4,4

    B

     4,5

    C

     5,4

    D

     5,5

    E

     Compilation fails.


    正确答案: B
    解析: 暂无解析

  • 第20题:

    多选题
    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().


    正确答案: A,B
    解析: 暂无解析

  • 第21题:

    单选题
    1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   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; }


    正确答案: D
    解析: 暂无解析

  • 第22题:

    单选题
    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; }


    正确答案: A
    解析: 暂无解析

  • 第23题:

    多选题
    1. class Super {  2. private int a;  3. protected Super(int a) { this.a = a; }  4. }  .....  11. class Sub extends Super {  12. public Sub(int a) { super(a); }  13. public Sub() { this.a= 5; }  14. }  Which two, independently, will allow Sub to compile?()
    A

    Change line 2 to: public int a;

    B

    Change line 2 to: protected int a;

    C

    Change line 13 to: public Sub() { this(5); }

    D

    Change line 13 to: public Sub() { super(5); }

    E

    Change line 13 to: public Sub() { super(a); }


    正确答案: E,D
    解析: 暂无解析

  • 第24题:

    多选题
    public class Car {  private int wheelCount;  private String vin;  public Car(String vin) {  this.vin = vin;  this.wheelCount = 4;  }  public String drive() {  return “zoom-zoom”;  }  public String getInfo() {  return “VIN: “+ vin + “wheels: “+ wheelCount;  }  }  And:  public class MeGo extends Car {  public MeGo(String vin) {  this.wheelCount = 3;  }  }  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;


    正确答案: C,F
    解析: 暂无解析