public class ForCounter
1: // Fig. 5.2: ForCounter.java
2: // Counter-controlled repetition with the for repetition statement.
3:
4: public class ForCounter
5: {
6: public static void main( String args[] )
7: {
8: // for statement header includes initialization,
9: // loop-continuation condition and increment
10: for ( int counter = 1; counter <= 10; counter++ )
11: System.out.printf( "%d ", counter );
12:
13: System.out.println(); // output a newline
14: } // end main
15: } // end class ForCounter
16:
17:
18: /**************************************************************************
19: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
20: * Pearson Education, Inc. All Rights Reserved. *
21: * *
22: * DISCLAIMER: The authors and publisher of this book have used their *
23: * best efforts in preparing the book. These efforts include the *
24: * development, research, and testing of the theories and programs *
25: * to determine their effectiveness. The authors and publisher make *
26: * no warranty of any kind, expressed or implied, with regard to these *
27: * programs or to the documentation contained in these books. The authors *
28: * and publisher shall not be liable in any event for incidental or *
29: * consequential damages in connection with, or arising out of, the *
30: * furnishing, performance, or use of these programs. *
31: *************************************************************************/