import java.io.*; /** * Echo3.java *
* A class to demonstrate terminal I/O. *
* Created: Fri Feb 7 07:49:50 2003 * * @author Stuart C. Shapiro */ public class Echo3 { /** * A demonstration of a Read/Print loop, * and the recognition of IOException. * * @param args a String[] value * @exception IOException if an error occurs */ public static void main (String[] args) throws IOException { String input; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true) { System.out.print("Say something (\"Bye\" to end): "); input = reader.readLine(); if (input == null || input.equals("Bye")) break; System.out.println("You said =>" + input + "<="); } // end of while (true) System.out.println("Goodbye."); } // end of main () }// Echo3