Given:
2. class Animal { 3. void speak() { System.out.print("bark "); } 4. static void play() { System.out.print("catching "); } 5. } //from w ww. java2s . c om 6. class Main extends Animal { 7. void speak() { System.out.print("howl "); } 8. public static void main(String[] args) { 9. new Main().go(); 10. super.play(); 11. super.speak(); 12. } 13. void go() { 14. super.play(); 15. speak(); 16. super.speak(); 17. } 18. }
What is the result? (Choose all that apply.)
D and E are correct.
Remember "super" is an instance variable, so it CANNOT be used from the static context of main()
.