1 public class STest2 extends SuperB { 2 3 private int x = 9; 4 5 public static void main(String [] args){ 6 STest2 st2 = new STest2(); 7 st2.run(); 8 } 9 10 11 public void run(){ 12 System.out.println(super.z); 13 super.go(); 14 } 15 16 public void go(){ 17 System.out.println("going"); 18 } 19 } 20 21 class SuperB extends SuperA { 22 public int z = 6; 23 protected int w = 7; 24 public void go(){ 25 System.out.println("go from SuperB"); 26 } 27 public void go1(){ 28 System.out.println("go1 from SuperB"); 29 } 30 protected void going1(){ 31 System.out.println("going1 from SuperB"); 32 } 33 } 34 class SuperA { 35 public int x = 9; 36 protected int y = 8; 37 public void go(){ 38 System.out.println("go from SuperA"); 39 } 40 protected void going(){ 41 System.out.println("going from SuperA"); 42 } 43 } 44 45 | Popular Tags |