// StringWideReverse.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-15 File created. // 2006-02-15 Last modification. // A solution to Exercise 8-1. import java.util.* ; class StringWideReverse { public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; System.out.print("\n This program is able to widen and reverse a string." + "\n Please, type in a string.\n\n " ) ; String string_from_keyboard = keyboard.nextLine() ; System.out.print("\n String length is " + string_from_keyboard.length() + ".\n\n String in wide reverse character order: \n\n "); int character_index = string_from_keyboard.length() ; while ( character_index > 0 ) { character_index -- ; System.out.print( " " + string_from_keyboard.charAt( character_index ) ) ; } } }