|
|

|
#5. Given: 1. interface Animal { 2. void soundOff(); 3. } 4. 5. class Elephant implements Animal { 6. public void soundOff() { 7. System. out. println(“Trumpet” ); 8. } 9. } 10. 11. class Lion implements Animal { 12. public void soundOff() { 13. System. out. println(“Roar” ); 14. } 15. } 16. 17. class Alpha1 { 18. static Animal get ( String choice ) { 19. if ( choice.equalsIgnoreCase( “meat eater” )) { 20. return new Lion(); 21. } else { 22. return new Elephant(); 23. } 24. } 25. }
Which compiles?
Показать комментарии к этому вопросу (0)
Добавить комментарии
Ссылка на этот вопрос
|
|
|
|
ген. 0.19
|
Дата сервера 12:08 09-01-2009
|
Разработал Zip © 2006
|
|
 |
|
|