问题描述
文本文件中的示例
1名称年龄
2姓名年龄
3姓名年龄
当我关闭程序并再次保存应该是
1名称年龄
2名称年龄
3名称年龄
4姓名年龄
我尝试过:
i不知道如何制作这是我的进步。
文件文件=新文件(new_member.txt);
FileWriter fw = new FileWriter (file.getAbsoluteFile(),true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(ID +,+ name +,+ value + ,0+ number +,+ email +,+ member_type +,+ register +,+ monthly +,+ total +,+ Date +\ n);
bw.close();
Example in text file
1 name age
2 name age
3 name age
when i close the program and save again should be
1 name age
2 name age
3 name age
4 name age
What I have tried:
i have no idea how to make it this is my progress.
File file =new File("new_member.txt");
FileWriter fw = new FileWriter(file.getAbsoluteFile(),true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(ID+","+name+","+value+",0"+number+","+email+","+member_type+","+register+","+monthly+","+total+","+Date+"\n");
bw.close();
推荐答案
class Person {
public int id;
public string name;
public int age;
}
根据您的要求添加其他字段。
Add other fields as per your requirements.
这篇关于Java如何在文本文件中进行整数值自动增量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!