第1楼 2007-05-06 13:24 chenlingling0527child 写道:
一道JAVA题目,请帮忙修改,尽快哦
题目:从标准设备中输入若干行英文句子,直到输入“bye”结束,将这些字符串写入文件
import java.io.*;
public class Echo1 {
public static void main (String args[])
throws java.io.IOException
{
String s;
InputStreamReader ir;
BufferedReader in;
System.out.print("please enter strings:\n");
try{
//将System.in转化为面向字符的流
ir = new InputStreamReader(System.in);
in = new BufferedReader(ir);//为输入流提供缓冲区
while ((s = in.readLine()) != "bye")
System.out.println("Read: " + s);
}
catch(IOException e)
{System.out.println("Error! ");}
}
}