public class RichRobotOwner { Robot[] myRobots; public RichRobotOwner( Robot[] newRobots ) { this.myRobots = newRobots; int i = 0; // switch everyone on. while( i < this.myRobots.length ) { this.myRobots[i].switchOn(); i += 1; } // Go on vacation in the Cayman Islands. try { Thread.sleep( 7*24*60*60*1000 ); } catch ( InterruptedException e ) { System.out.println( "Hey! This better be important ..." ); } // switch everone off. i = 0; while( i < this.myRobots.length ) { this.myRobots[i++].switchOn(); // use postincrement to // automatically inc i *after* // using it } } }