Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A7 {
- int x = 10;
- int y = 20;
- }
- class B7 extends A7 {
- int x = 30;
- int y = 40;
- }
- public class TestAB {
- public static void main(String[] args) {
- B7 b = new B7();
- A7 a = new B7();
- System.out.println(b.x + ": " + b.y);
- System.out.println(a.x + ": " + a.y);
- b.x = 5;
- b.y = 6;
- System.out.println(b.x + ": " + b.y);
- System.out.println(a.x + ": " + a.y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement