单项选择题
interface Data { public void load(); }
abstract class Info { public abstract void load(); }
Which class correctly uses the Data interface and Info class?()
A. public class Employee extends Info implements Data { public void load() { /*do something*/ } }
B. public class Employee implements Info extends Data { public void load() { /*do something*/ } }
C. public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
D. public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
E. public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
F. public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
相关考题
-
多项选择题
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; } -
单项选择题
public abstract class Shape { int x; int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } and a class Circle that extends and fully implements the Shape class. Which is correct?()
A. Shape s = new Shape(); s.setAnchor(10,10); s.draw();
B. Circle c = new Shape(); c.setAnchor(10,10); c.draw();
C. Shape s = new Circle(); s.setAnchor(10,10); s.draw();
D. Shape s = new Circle(); s->setAnchor(10,10); s->draw();
E. Circle c = new Circle(); c.Shape.setAnchor(10,10); c.Shape.draw(); -
单项选择题
1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. } 7. } 8. } What is the result?()
A. test
B. null
C. An exception is thrown at runtime.
D. Compilation fails because of an error in line 1.
E. Compilation fails because of an error in line 4.
F. Compilation fails because of an error in line 5.
