【文章內(nèi)容簡(jiǎn)介】
:10. interface Data { public void load()。 }11. 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 () { /*do something*/ }}D. public class Employee implements Info extends Data {public void () { /*d something */ }public void load() { /*do something */ }}E. public class Employee implements Info extends Data {public void load() { /*do something */ }public void (){ /*do something*/ }}F. public class Employee extends Info implements Data{public void () { /*do something*/ }public void () { /*do something*/ }}Answer: AQuestion 18Given:11. public abstract class Shape {12. private int x。Copyright Tarena Corporation, rights reserved13. private int y。14. public abstract void draw()。15. public void setAnchor(int x, int y) {16. = x。17. = y。18. }19. }Which two classes use the Shape class correctly? (Choose two.)A. public class Circle implements Shape {private int radius。}B. public abstract class Circle extends Shape {private int radius。}C. public class Circle extends Shape {private int radius。public void draw()。}D. public abstract class Circle implements Shape {private int radius。public void draw()。}E. public class Circle extends Shape {private int radius。public void draw() {/* code here */}}F. public abstract class Circle implements Shape {private int radius。public void draw() { / code here */ }}Answer: BEQuestion 19Which two classes correctly implement both the and the interfaces? (Choose two.)A. public class Sessionimplements Runnable, Clonable {public void run()。Copyright Tarena Corporation, rights reservedpublic Object clone()。}B. public class Sessionextends Runnable, Clonable {public void run() { / do something */ }public Object clone() { / make a copy */ }}C. public class Sessionimplements Runnable, Clonable {public void run() { / do something */ }public Object clone() { /* make a copy */ }}D. public abstract class Sessionimplements Runnable, Clonable {public void run() { / do something */ }public Object clone() { /*make a copy */ }}E. public class Sessionimplements Runnable, implements Clonable {public void run() { / do something */ }public Object clone() { / make a copy */ }}Answer: CDQuestion 20Given:10. class One {11. public One() { (1)。 }12. }13. class Two extends One {14. public Two() { (2)。 }15. }16. class Three extends Two {17. public Three() { (3)。 }18. }19. public class Numbers{20. public static void main( String[] argv) { new Three()。 }21. }What is the result when this code is executed?A. 1B. 3Copyright Tarena Corporation, rights reservedC. 123D. 321E. The code rims with no output.Answer: CQuestion 21Given classes defined in two different files:1. package packageA。2. public class Message {3. String getText() { return “ text ” 。 }4. }and:1. package packageB。2. public class XMLMessage extends {3. String getText() { return “ msgtext/msg ” 。 }4. public static void main(String[] args) {5. (new XMLMessage().getText())。6. }7. }What is the result of executing ?A. textB. msgtext/msgC. An exception is thrown at runtime.D. Compilation fails because of an error in line 2 of XMLMessage.E. Compilation fails because of an error in line 3 of XMLMessage.Answer: BQuestion 22Given:11. interface DeclareStuff{12. public static final int EASY = 3。13. void doStuff(int t)。 }14. public class TestDeclare implements DeclareStuff {15. public static void main(String [] args) {16. int x=5。17. new TestDeclare().doStuff(++x)。18. }19. void doStuff(int s) {20. s += EASY + ++s。21. ( s + s)。22. }23. }What is the result?A. s 14Copyright Tarena Corporation, rights reservedB. s 16C. s 10D. Compilation fails.E. An exception is thrown at runtime.Answer: DQuestion 2341. Given:10. class One {11. public One foo() { return this。 }12. }13. class Two extends One {14. public One foo() { return this。 }15. }16. class Three extends Two {17. // insert method here18. }Which two methods, inserted individually, correctly plete the Threeclass? (Choose two.)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。 }Answer: CDQuestion 24Given:10. class One {11. void foo() {}12. }13