Advertisement
Guest User

Output Challenge Java

a guest
Jul 12th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. public class Point{
  2.     public static int x = 7;
  3.     public int y = 3;
  4. }
  5. public static void main(String [ ] args)
  6. {
  7.         Point a = new Point ();
  8.         Point b = new Point ();
  9.         a.x = 9;
  10.         b.x = 4;
  11.         a.y = 2;
  12.         b.y = 1;
  13.         a.x += Point.x;
  14.         b.y += Point.x;
  15.         System.out.println("a.y = " + a.y); // a.y = 2
  16.         System.out.println("b.y = " + b.y); // b.y = 8
  17.         System.out.println("a.x = " + a.x); // a.x = 16
  18.         System.out.println("b.x = " + b.x); // b.x = 4
  19.         System.out.println("Point.x = " + Point.x); // Point.x = 7
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement