Load up class into NetBeans.
We are going to write an inner class that will allow us to
generate an
Iterator
and an
Iterable
.
Then we’ll be able to write code looking like this:
public static void main(String[] args) { RotatedRectangle myRect = new RotatedRectangle(100, 100, 20, 20) ; for (int rotation = 0; rotation < 360; rotation += 10) { myRect.setRotation(rotation); System.out.println(myRect) ; for (int[] a : myRect) { System.out.println("(" + a[0] + "," + a[1] + ")") ; } } }