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. }第18行什么意识?这是一个get函数,他实现了Animal接口??是这样?有这样的功能吗?请高手指点.