smeacham

MoveTester.java

Jan 26th, 2015
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.awt.Rectangle;
  2.  
  3. public class MoveTester
  4. {
  5.    public static void main(String[] args)
  6.    {
  7.       Rectangle box = new Rectangle(5, 10, 20, 30);
  8.  
  9.       // Move the rectangle
  10.       box.translate(15, 25);
  11.  
  12.       // Print information about the moved rectangle
  13.       System.out.print("x: ");
  14.       System.out.println(box.getX());
  15.       System.out.println("Expected: 20");
  16.  
  17.       System.out.print("y: ");
  18.       System.out.println(box.getY());
  19.       System.out.println("Expected: 35");  
  20.    }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment