// String #4: what is the output? import javax.swing.JOptionPane; public class String_4 { public static void main( String[] args ) { String s1 = JOptionPane.showInputDialog("Type in a sentence : "); int length = s1.length(); int counter = 0; System.out.println("You entered: \n" ); while (counter < length) { if ((s1.charAt(counter)) == 32) System.out.print("\n"); else System.out.print(s1.charAt(counter) ); counter++; } System.out.print("\n"); System.exit( 0 ); } // end main } // end of program