import java.util.ArrayList; public class Point { public double x, y; public Point(double x0, double y0) { x = x0; y = y0; } public double dist(Point otherPoint) { return Math.pow(Math.pow(x - otherPoint.x, 2) + Math.pow(y - otherPoint.y, 2), .5); } public static void main(String[] args) { Point[] arrayOfPoints = new Point[10]; for (int i = 0; i < 9; i++) { arrayOfPoints[i] = new Point(i, i); } // double distFromStartToEnd = arrayOfPoints[0].dist(arrayOfPoints[9]); arrayOfPoints[9] = new Point(9, 9); // arrayOfPoints[10] = new Point(10, 10); ArrayList listOfPoints = new ArrayList(); for (Point point : arrayOfPoints) { listOfPoints.add(point); } // listOfPoints.iterator().remove(); Object thirdSlot = arrayOfPoints[3]; String badCast = (String) thirdSlot; System.out.println("Real math: " + 5 / 0); System.out.println( "If this gets reached, you should have 5 lines commented out and you have found all the Exceptions!"); } }