double getSalesAmount() { return 1230.45; }
public double getSalesAmount() { return 1230.45; }
private double getSalesAmount() { return 1230.45; }
protected double getSalesAmount() { return 1230.45; }
第1题:
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; }
第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?()
第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;}
第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?()
第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?()
第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?()
第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?()
第8题:
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; }
第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?()
第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?()