请麻烦你说清楚点好吗 。我用了很多,但都是错的。请你看下面的代码:
import java.io.*
public class class1
{ public static void main (String args[]) throws Exception
{
BufferedReader br=new BufferedRead(
new InputStreamReader(System.in));
String s;
System.out.print("输入一个字符串:");
System.out.flush();
s=br.readLine();
System.out.println("您所输入的 字符串时:"+s);
}
}
可以这样写吗????

解决方案 »

  1.   

    String line = "";
    BufferedReader input = null;
    try
    {
      input = new BufferedReader(new InputStreamReader(System.in));
      while ((line = input.readLine()) != null)
      {
        if(readline.equalsIgnoreCase("exit"))
        {
          input.close();
          System.exit(1);
        }
        System.out.println(line);
      }
    }
    catch (Exception err)
    {
       err.printStackTrace();
       try{  input.close();}
       catch(Exception eClose){}
    }