waltermilner

Untitled

Jun 15th, 2016
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.29 KB | None | 0 0
  1. class Test {
  2.  
  3.   public static void main(String[] args) {
  4.     C c = new C();
  5.     c.display(); //90 - don't do it!!
  6.    
  7.   }
  8. }
  9.  
  10. class A {
  11.  
  12.   int x = 90;
  13. }
  14.  
  15. class B extends A {
  16.  
  17.   void display() {
  18.     System.out.println(super.x);
  19.   }
  20. }
  21.  
  22. class C extends B {
  23.  
  24.   int x = 80;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment