java中怎么输入一个字符
收起
云计算小粉
2018-05-10 20:07:55
3685
0
1
条回答
写回答
取消
提交回答
-
import java.io.*;
public class Test
{
public static void main(String[] args) throws IOException
{
BufferedReader buf = new BufferedReader (new InputStreamReader(System.in));
BufferedWriter buff = new BufferedWriter(new FileWriter("abc.txt"));
String str = buf.readLine();
while(!str.equals("exit"))
{
buff.write(str);
buff.newLine();
str = buf.readLine();
}
buf.close();
buff.close();
}
}
2019-07-17 22:16:27