previous | start | next

File MoveRect.java

1 import java.awt.Rectangle; 
2
3 public class MoveTest
4 {
5    public static void main(String[] args)
6    {
7       Rectangle cerealBox = new Rectangle(5, 10, 20, 30);
8       // move the rectangle
9       cerealBox.translate(15, 25);
10       // print the moved rectangle
11       System.out.println(cerealBox);
12    }



previous | start | next