fork download
  1. class Father {
  2. public String met1(){
  3. return "c ";
  4. }
  5. protected String met2(){
  6. return "b "+met1();
  7. }
  8. }
  9. class Child extends Father {
  10. public String met1(){
  11. return "a ";
  12. }
  13. }
  14. class GrandChild extends Child {
  15. public String met2(){
  16. return super.met2() + "z" ;
  17. }
  18. public static void main(String[] args){
  19. Father f = new GrandChild();
  20. System.out.println(f.met2()); // Compile error here
  21. }
  22. }
Success #stdin #stdout 0.08s 27768KB
stdin
Standard input is empty
stdout
b a z