【java从键盘输入一些字符串,并将字符串保存到一个文件中】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();
}
}