// This program includes several methods demonstrating various uses // of for loops. public class ForLoops { public static void main(String[] args) { for (int i = 1; i <= 1000; i++) { System.out.println("I am one with the Force. The Force is with me."); } System.out.println(); count(); printSquares(); } // Count from 1 to 10 in the style of Count von Count from Sesame Street. // Notice the use of the loop variable i inside the loop. public static void count() { for (int i = 1; i <= 10; i++) { System.out.println("That's " + i + "! Ha ha ha!"); } System.out.println(); } // Print out the squares of the integers from 1 to 10, one per line. public static void printSquares() { for (int i = 1; i <= 10; i++) { System.out.println(i + " squared = " + (i * i)); } System.out.println(); } }