// using "showMessageDialog" to stop along the way as a "debugging" tool // while loop example #3 import javax.swing.JOptionPane; public class while_loop_3 { public static void main( String[] args ) { int counter = 1; // value of counter after it is primed JOptionPane.showMessageDialog(null, "The value of counter now is " + counter, "Input Window Demo", JOptionPane.INFORMATION_MESSAGE); while (counter <= 10) { System.out.println("I will not fly any more paper airplanes in this room."); // value of counter for each iteration of the loop as it is updated JOptionPane.showMessageDialog(null, "The value of counter now is " + counter, "Input Window Demo", JOptionPane.INFORMATION_MESSAGE); counter++; } // value of counter after the loop test fails JOptionPane.showMessageDialog(null, "The value of counter now is " + counter, "Input Window Demo", JOptionPane.INFORMATION_MESSAGE); System.exit( 0 ); // terminate application } // end main } // end of program