import java.io.*;
public class ReadTest{
public static void main(String[] args) {
System.out.println("Please type some words in console");
BufferedReader  buff = new BufferedReader(new InputStreamReader(System.in));
try{
System.out.println("You Typed" + buff.readLine());
}catch (Exception ex) {
} }
}

解决方案 »

  1.   

    稍微改了一下public static void main(String[] args) throws IOException{
        while(true){
          System.out.println(
              "Please type some words in console,type 'Quit' for quit");
          BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
          String typein = buff.readLine();
          if (!typein.equals("Quit"))
              System.out.println("You Typed" + typein);
          else
            break;
          }
        }