JavaVER.01-12

Page 115

} What is the result? A. B. C. D.

Compilation fails. Cannot add Toppings The code runs with no output. A NullPointerException is thrown in Line 4.

Answer: A Section: All Explanation/Reference:

QUESTION 8 Which three statements are true? (Choose three.) A. B. C. D. E. F. G.

A final method in class X can be abstract if and only if X is abstract. A protected method in class X can be overridden by any subclass of X. A private static method can be called only within other static methods in class X. A non-static public final method in class X can be overridden in any subclass of X. A public static method in class X can be called by a subclass of X without explicitly referencing the class X. A method with the same signature as a private final method in class X can be implemented in a subclass of X. 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.

Answer: BEF Section: All Explanation/Reference:

QUESTION 9 Click the Exhibit button. 1. public class Car { 2. private int wheelCount; 3. private String vin; 4. public Car(String vin){ 5. this.vin = vin; 6. this.wheelCount = 4; 7. } 8. public String drive(){ 9. return "zoom-zoom"; 10. } 11. public String getInfo() { 12. return "VIN: " + vin + " wheels: " + wheelCount; 13. } 14. } And 1. public class MeGo extends Car { 2. public MeGo(String vin) { 3. this.wheelCount = 3; 4. } 5. } What two must the programmer do to correct the compilation errors? (Choose two.)


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.