001 package classwork;
002 import java.awt.*;
003
004 /**
005 * Constructs two rectangles and prints out the box formed by their intersection.
006 * @author Tom James
007 *
008 */
009 public class Intersection {
010
011 /**
012 * @param args
013 */
014 public static void main(String[] args) {
015 Rectangle box1 = new Rectangle(0,0,10,20);
016 Rectangle box2 = new Rectangle(5,5,40,30);
017 Rectangle box3 = new Rectangle(box2.x,box2.y,box1.width-box2.x,box1.height-box2.y);
018 System.out.println("Box3:" + box3);
019 }
020
021 }