Given:
3. class Shape { 4. void go1() { System.out.print("1 "); } 5. final void go2() { System.out.print("2 "); } 6. private void go3() { System.out.print("3 "); } 7. } /*from ww w.j a va 2 s.co m*/ 8. public class Main extends Shape { 9. void go1() { System.out.print("1b "); } 10. void go3() { System.out.print("3b "); } 11. 12. public static void main(String[] args) { 13. new Main().go1(); 14. new Shape().go1(); 15. new Main().go2(); 16. new Main().go3(); 17. new Shape().go3(); 18. } }
What is the result?
D is correct.
The only error is on line 17: Class Main cannot find class Shape's private go3() method.
Note that on line 10 we're NOT overriding class Shape's go3() method.