public class Dome06 {
public static void main(String[] args) throws IOException {
FileOutputStream fos=new FileOutputStream("d:\\info.txt",true);
Scanner s=new Scanner(System.in);
boolean bl=true;
while (bl) {
System.out.println("请输入录入信息:");
String s1 = s.nextLine();
if (s1.equals("886")){
System.out.println("谢谢使用。再见");
bl=false;
}else {
fos.write(s1.getBytes());
fos.write("\r\n".getBytes());
System.out.println("添加成功,请在文件中查看,输入886退出");
}
}
}
} |
|