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

题目
多选题
class BaseClass{   private float x= 1.0f;   protected void setVar (float f) {x = f;}   }   class SubClass exyends BaseClass {   private float x = 2.0f;   //insert code here  8. }   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; }


相似考题
参考答案和解析
正确答案: A,E
解析: 暂无解析
更多“多选题class BaseClass{   private float x= 1.0f;   protected void setVar (float f) {x = f;}   }   class SubClass exyends BaseClass {   private float x = 2.0f;   //insert code here  8. }   Which two are valid examples of method overriding?()AVoid setVar(float ”相关问题
  • 第1题:

    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

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

    abstract class abstrctIt {   abstract float getFloat ();   }   public class AbstractTest extends AbstractIt {   private float f1= 1.0f;   private float getFloat () {return f1;}   }   What is the result? ()

    • A、 Compilation is successful.
    • B、 An error on line 6 causes a runtime failure.
    • C、 An error at line 6 causes compilation to fail.
    • D、 An error at line 2 causes compilation to fail.

    正确答案:C

  • 第4题:

    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

  • 第5题:

    public class MethodOver {   private int x, y;   private float z;   public void setVar(int a, int b, float c){   x = a;   y = b;   z = c;   }   }   Which two overload the setVar method?()

    • A、 void setVar (int a, int b, float c){  x = a;  y = b;  z = c;  }
    • B、 public void setVar(int a, float c, int b) {  setVar(a, b, c);  }
    • C、 public void setVar(int a, float c, int b) {  this(a, b, c);  }
    • D、 public void setVar(int a, float b){  x = a;  z = b;  }
    • E、 public void setVar(int ax, int by, float cz) {  x = ax;  y = by;  z = cz;  }

    正确答案:B,D

  • 第6题:

    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

  • 第7题:

    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 public void foo() { /* more code here */ }
    • B、 private void foo() { /* more code here */ }
    • C、 protected void foo() { /* more code here */ }
    • D、 int foo() { /* more code here */ }  
    • E、 void foo() { /* more code here */ }

    正确答案:A,C,E

  • 第8题:

    单选题
    abstract class abstrctIt {  abstract float getFloat ();  } public class AbstractTest extends AbstractIt { private float f1= 1.0f;  private float getFloat () {return f1;}  }   What is the result?()
    A

     Compilation is successful.

    B

     An error on line 6 causes a runtime failure.

    C

     An error at line 6 causes compilation to fail.

    D

     An error at line 2 causes compilation to fail.


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

  • 第9题:

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


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

  • 第10题:

    多选题
    Which two cause a compiler error?()
    A

    float[] = new float(3);

    B

    float f2[] = new float[];

    C

    float[] f1 = new float[3];

    D

    float f3[] = new float[3];

    E

    float f5[] = { 1.0f, 2.0f, 2.0f };

    F

    float f4[] = new float[] { 1.0f. 2.0f. 3.0f};


    正确答案: D,C
    解析: The F. statement is incorrect. The float numbers should be separated with commas and not dots.

  • 第11题:

    多选题
    class BaseClass{   private float x= 1.0f;   protected void setVar (float f) {x = f;}   }   class SubClass exyends BaseClass {   private float x = 2.0f;   //insert code here  8. }   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
    解析: 暂无解析

  • 第12题:

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

    void setVar (int a, int b, float c){ x = a; y = b; z = c; }

    B

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

    C

    public void setVar(int a, float c, int b) { this(a, b, c); }

    D

    public void setVar(int a, float b){ x = a; z = b; }

    E

    public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; }


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

  • 第13题:

    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()

    • A、 int foo() { /* more code here */ }
    • B、 void foo() { /* more code here */ }
    • C、 public void foo() { /* more code here */ }
    • D、 private void foo() { /* more code here */ }
    • E、 protected void foo() { /* more code here */ }

    正确答案:B,C,E

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

    Which two cause a compiler error?() 

    • A、 float[] = new float(3);
    • B、 float f2[] = new float[];
    • C、 float[] f1 = new float[3];
    • D、 float f3[] = new float[3];
    • E、 float f5[] = { 1.0f, 2.0f, 2.0f };
    • F、 float f4[] = new float[] { 1.0f. 2.0f. 3.0f};

    正确答案:A,B

  • 第16题:

    class BaseClass{   private float x= 1.0f;   protected void setVar (float f) {x = f;}   }   class SubClass exyends BaseClass {   private float x = 2.0f;   //insert code here  8. }   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

  • 第17题:

    Which two are valid declarations of a float?()

    • A、 float f = 1F;
    • B、 float f = 1.0.;
    • C、 float f = ‘1’;
    • D、 float f = “1”;
    • E、 float f = 1.0d;

    正确答案:A,C

  • 第18题:

    Which three statements are true?()

    • A、A final method in class X can be abstract if and only if X is abstract.
    • B、A protected method in class X can be overridden by any subclass of X.
    • C、A private static method can be called only within other static methods in class X.
    • D、A non-static public final method in class X can be overridden in any subclass of X.
    • E、A public static method in class X can be called by a subclass of X without explicitly referencing the class X.
    • F、A method with the same signature as a private final method in class X can be implemented in a subclass of X.
    • G、A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.

    正确答案:B,E,F

  • 第19题:

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


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

  • 第20题:

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


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

  • 第21题:

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


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

  • 第22题:

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

  • 第23题:

    多选题
    Which three statements are true?()
    A

    A final method in class X can be abstract if and only if X is abstract.

    B

    A protected method in class X can be overridden by any subclass of X.

    C

    A private static method can be called only within other static methods in class X.

    D

    A non-static public final method in class X can be overridden in any subclass of X.

    E

    A public static method in class X can be called by a subclass of X without explicitly referencing the class X.

    F

    A method with the same signature as a private final method in class X can be implemented in a subclass of X.

    G

    A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.


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

  • 第24题:

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


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