|
|
Authorized user can see question and answers. Please log in or sign up. 
|
#35. Given: 1. class Pizza { 3. public final void addTopping (String topping ) { 4. toppings.add(topping); 5. } 6. } 7. public class PepperoniPizza extends Pizza { 8. public void addTopping (String topping ) { 9. System. out. println(”Cannot add Toppings” ); 10. } 11. public static void main (String[] args ) { 12. Pizza pizza = new PepperoniPizza(); 13. pizza .addTopping(“Mushrooms”); 14. } 15. }
What is the result?
Show comments for this question (0)
Add comments
Link to this question
|
|
#37. Given: 11. abstract class Vehicle { public mt speed() (return 0; }} 12. class Car extends Vehicle { public mt speed() (return 60; }} 13. class RaceCar extends Car { public mt speed() { return 150; }} … 21. RaceCar racer = new RaceCar(); 22. Car car = new RaceCar(); 23. Vehicle vehicle = new RaceCar(); 24. System . out. println(racer. speed() + “ , “ + car. speed() 25. + “, “ vehicle.speed());
What is the result?
Show comments for this question (0)
Add comments
Link to this question
|
|
#39. Given: 10. abstract class A { 11. abstractvoid a1(); 12. void a2() { } 13. } 14. class B extends A { 15. void a1(){ } 16, void a2 (){ } 17. } 18. class C extends B (void do { } } And:
Ax = new B(); C y = new C(); A z = new C();
What are four valid examples of polymorphic method calls? (Choose four.)
Show comments for this question (0)
Add comments
Link to this question
|
|
|
|
gen. 0.296
|
Server date 05:37 10-01-2009
|
Developed by Zip © 2006
|
|
 |
|
|