// Using "for" loops and strings import javax.swing.JOptionPane; public class ForLoopsStrings1 { public static void main( String[] args ) { String s1 = JOptionPane.showInputDialog("Type a word or phrase : "); int length = s1.length(); System.out.println("You entered the string \"" + s1 + "\"" ); for (int counter = 0; counter < length; counter++) { System.out.println("Character #: " + counter + " " + s1.charAt(counter)); } System.out.print("\n"); System.exit( 0 ); } // end main } // end of program