Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Point{
- public static int x = 7;
- public int y = 3;
- }
- public static void main(String [ ] args)
- {
- Point a = new Point ();
- Point b = new Point ();
- a.x = 9;
- b.x = 4;
- a.y = 2;
- b.y = 1;
- a.x += Point.x;
- b.y += Point.x;
- System.out.println("a.y = " + a.y); // a.y = 2
- System.out.println("b.y = " + b.y); // b.y = 8
- System.out.println("a.x = " + a.x); // a.x = 16
- System.out.println("b.x = " + b.x); // b.x = 4
- System.out.println("Point.x = " + Point.x); // Point.x = 7
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement