Advertisement
JeffGrigg

TestAB 1

Jul 21st, 2018
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.46 KB | None | 0 0
  1. class A7 {
  2.     int x = 10;
  3.     int y = 20;
  4. }
  5.  
  6. class B7 extends A7 {
  7.     int x = 30;
  8.     int y = 40;
  9. }
  10.  
  11. public class TestAB {
  12.     public static void main(String[] args) {
  13.         B7 b = new B7();
  14.         A7 a = new B7();
  15.         System.out.println(b.x + ": " + b.y);
  16.         System.out.println(a.x + ": " + a.y);
  17.         b.x = 5;
  18.         b.y = 6;
  19.         System.out.println(b.x + ": " + b.y);
  20.         System.out.println(a.x + ": " + a.y);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement