// Basic Algorithms, Fall'98 (Yap) // Illustrating basic input and output import java.io.*; class IO { public static void main(String[] args) throws java.io.IOException // alternatively: "throws Exception" { // OUTPUT: System.out.println("Hello" + " World!"); System.out.print("Quit? (Type \"Y\" or \"y\" to quit)"); System.out.flush(); // INPUT: BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); // in = InputStream String response; response = in.readLine(); if(!response.equals("Y") && !response.equals("y")) System.out.print("Continuing...\n"); else System.out.println("...Done!"); System.out.flush(); } }