// second for loop: the number of repetitions is determined by the user import javax.swing.JOptionPane; public class ForLoops2 { public static void main( String[] args ) { // Prompt the user to enter how many times to repeat String numString1 = JOptionPane.showInputDialog(null, "How many times do you want to repeat the message? ", "Input Number Window", JOptionPane.QUESTION_MESSAGE); // Convert the string into an int value int times = Integer.parseInt(numString1); for(int counter=1; counter <= times; counter++) { System.out.println("This statement is repeated. This time is # " + counter); } System.exit( 0 ); } // end main } // end of program