多选题Given: Which two methods, inserted independently at line 17, correctly complete the Sales class?()Adouble getSalesAmount() { return 1230.45; }Bpublic double getSalesAmount() { return 1230.45; }Cprivate double getSalesAmount() { return 1230.45; }Dprote

题目
多选题
Given: Which two methods, inserted independently at line 17, correctly complete the Sales class?()
A

double getSalesAmount() { return 1230.45; }

B

public double getSalesAmount() { return 1230.45; }

C

private double getSalesAmount() { return 1230.45; }

D

protected double getSalesAmount() { return 1230.45; }

参考答案和解析
正确答案: B,D
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Which code, inserted at line 15, allows the class Sprite to compile?()

A.Foo { public int bar() { return 1; }

B.new Foo { public int bar() { return 1; }

C.new Foo() { public int bar() { return 1; }

D.new class Foo { public int bar() { return 1; }


参考答案:C

第2题:

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

第3题:

10.abstractpublicclassEmployee{11.protectedabstractdoublegetSalesAmount();12.publicdoublegetCommision(){13.returngetSalesAmount()*0.15;14.}15.}16.classSalesextendsEmployee{17.//insertmethodhere18.}Whichtwomethods,insertedindependentlyatline17,correctlycompletetheSalesclass?()

A.doublegetSalesAmount(){return1230.45;}

B.publicdoublegetSalesAmount(){return1230.45;}

C.privatedoublegetSalesAmount(){return1230.45;}

D.protecteddoublegetSalesAmount(){return1230.45;}


参考答案:B, D

第4题:

class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()

  • A、 public void foo() { }
  • B、 public int foo() { return 3; }
  • C、 public Two foo() { return this; }
  • D、 public One foo() { return this; }
  • E、 public Object foo() { return this; }

正确答案:C,D

第5题:

10. abstract public class Employee {  11. protected abstract double getSalesAmount();  12. public double getCommision() {  13. return getSalesAmount() * 0.15;  14. }  15. }  16. class Sales extends Employee {  17. // insert method here  18. }  Which two methods, inserted independently at line 17, correctly complete the Sales class?()

  • A、 double getSalesAmount() { return 1230.45; }
  • B、 public double getSalesAmount() { return 1230.45; }
  • C、 private double getSalesAmount() { return 1230.45; }
  • D、 protected double getSalesAmount() { return 1230.45; }

正确答案:B,D

第6题:

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

正确答案:B,D

第7题:

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

第8题:

Given:Which two methods, inserted independently at line 17, correctly complete the Sales class?()

A.double getSalesAmount() { return 1230.45; }

B.public double getSalesAmount() { return 1230.45; }

C.private double getSalesAmount() { return 1230.45; }

D.protected double getSalesAmount() { return 1230.45; }


参考答案:B, D

第9题:

public class OuterClass {   private double d1 1.0;   //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()

  • 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

第10题:

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

更多相关问题