Advertisement
Guest User

question1

a guest
Feb 11th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. class Super
  2. {
  3.     public int i = 0;
  4.  
  5.     public Super(String text)
  6.     {
  7.         i = 1;
  8.     }
  9. }
  10.  
  11. class Sub extends Super
  12. {
  13.     public Sub(String text)
  14.     {
  15.         i = 2;
  16.     }
  17.  
  18.     public static void main(String args[])
  19.     {
  20.         Sub sub = new Sub("Hello");
  21.         System.out.println(sub.i);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement