单选题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?()APublic float getNum()   {return 4.0f; }BPublic void getNum ()  { }CPub

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


相似考题
更多“1. class super {  2. public float getNum() {return 3.0f;}  3”相关问题
  • 第1题:

    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

  • 第2题:

    1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?() 

    • A、 Compilation succeeds.
    • B、 An exception is thrown.
    • C、 Compilation fails because of an error at line 2.
    • D、 Compilation fails because of an error at line 6.

    正确答案:D

  • 第3题:

    类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()

    • A、public float aMethod(float a, float b,float c){ return 0;}
    • B、public float aMethod(float c,float d){ return 0;}
    • C、public int aMethod(int a, int b){ return 0;}
    • D、private float aMethod(int a,int b,int c){ return 0;}

    正确答案:B

  • 第4题:

    1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()  

    • A、 Just after line 5
    • B、 Just after line 6
    • C、 Just after line 7 (that is, as the method returns)
    • D、 Never in this method.

    正确答案:D

  • 第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题:

    单选题
    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
    解析: 暂无解析

  • 第7题:

    单选题
    类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()
    A

    public float aMethod(float a, float b,float c){ return 0;}

    B

    public float aMethod(float c,float d){ return 0;}

    C

    public int aMethod(int a, int b){ return 0;}

    D

    private float aMethod(int a,int b,int c){ return 0;}


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

  • 第8题:

    单选题
    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
    解析: 暂无解析

  • 第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; }


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

  • 第10题:

    多选题
    1. class BaseClass {  2. private float x = 1.of;  3. protected float getVar() { return x; }  4. }  5. class SubClass extends BaseClass {  6. private float x = 2.Of;  7. // insert code here 8. }   Which two are valid examples of method overriding when inserted at line 7?()
    A

    float getVar() { return x; }

    B

    public float getVar() { return x; }

    C

    public double getVar() { return x; }

    D

    protected float getVar() { return x; }

    E

    public float getVar(float f) { return f; }


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

  • 第11题:

    多选题
    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
    解析: 暂无解析

  • 第12题:

    多选题
    public class MethodOver {   public void setVar (int a, int b, float c) {   }   }   Which two overload the setVar method?()
    A

    Private void setVar (int a, float c, int b) {}

    B

    Protected void setVar (int a, int b, float c) {}

    C

    Public int setVar (int a, float c, int b) (return a;)

    D

    Public int setVar (int a, int b, float c) (return a;)

    E

    Protected float setVar (int a, int b, float c) (return c;)


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

  • 第13题:

    public class MethodOver {   public void setVar (int a, int b, float c) {   }   }   Which two overload the setVar method?()

    • A、 Private void setVar (int a, float c, int b) {}
    • B、 Protected void setVar (int a, int b, float c) {}
    • C、 Public int setVar (int a, float c, int b) (return a;)
    • D、 Public int setVar (int a, int b, float c) (return a;)
    • E、 Protected float setVar (int a, int b, float c) (return c;)

    正确答案:A,C

  • 第14题:

    Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?

    • A、 private void set Var(int a, float c, int b) {}
    • B、 protected void set Var(int a, int b, float c) {}
    • C、 public int set Var(int a, float c, int b) {return a:}
    • D、 public int set Var(int a, int b, float c) {return a:}
    • E、 protected float set Var(int a, int b, float c) {return c:}

    正确答案:A,C

  • 第15题:

    class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()        

    • A、 Void setVar(float f) {x = f;}
    • B、 Public void setVar(int f) {x = f;}
    • C、 Public void setVar(float f) {x = f;}
    • D、 Public double setVar(float f) {x = f;}
    • E、 Public final void setVar(float f) {x = f;}
    • F、 Protected float setVar() {x=3.0f; return 3.0f; }

    正确答案:C,E

  • 第16题:

    1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()  

    • A、 static class InnerOne { public double methoda() { return d1; } }
    • B、 static class InnerOne { static double methoda() { return d1; } }
    • C、 private class InnerOne { public double methoda() { return d1; } }
    • D、 protected class InnerOne { static double methoda() { return d1; } }
    • E、 public abstract class InnerOne { public abstract double methoda(); }

    正确答案:C,E

  • 第17题:

    单选题
    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
    解析: 暂无解析

  • 第18题:

    多选题
    Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?
    A

    private void set Var(int a, float c, int b) {}

    B

    protected void set Var(int a, int b, float c) {}

    C

    public int set Var(int a, float c, int b) {return a:}

    D

    public int set Var(int a, int b, float c) {return a:}

    E

    protected float set Var(int a, int b, float c) {return c:}


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

  • 第19题:

    单选题
    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
    解析: 暂无解析

  • 第20题:

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


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

  • 第21题:

    多选题
    class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()
    A

    Void setVar(float f) {x = f;}

    B

    Public void setVar(int f) {x = f;}

    C

    Public void setVar(float f) {x = f;}

    D

    Public double setVar(float f) {x = f;}

    E

    Public final void setVar(float f) {x = f;}

    F

    Protected float setVar() {x=3.0f; return 3.0f; }


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

  • 第22题:

    多选题
    1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()
    A

    static class InnerOne { public double methoda() { return d1; } }

    B

    static class InnerOne { static double methoda() { return d1; } }

    C

    private class InnerOne { public double methoda() { return d1; } }

    D

    protected class InnerOne { static double methoda() { return d1; } }

    E

    public abstract class InnerOne { public abstract double methoda(); }


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

  • 第23题:

    单选题
    1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?()
    A

     Compilation succeeds.

    B

     An exception is thrown.

    C

     Compilation fails because of an error at line 2.

    D

     Compilation fails because of an error at line 6.


    正确答案: 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
    解析: 暂无解析