Advertisement
JeffGrigg

TestAB 2

Jul 21st, 2018
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.50 KB | None | 0 0
  1. class A7 {
  2.     int ax = 10;
  3.     int ay = 20;
  4. }
  5.  
  6. class B7 extends A7 {
  7.     int bx = 30;
  8.     int by = 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("B7: " + b.bx + ": " + b.by);
  16.         System.out.println("A7: " + a.ax + ": " + a.ay);
  17.         b.bx = 5;
  18.         b.by = 6;
  19.         System.out.println("B7: " + b.bx + ": " + b.by);
  20.         System.out.println("A7: " + a.ax + ": " + a.ay);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement