public class Util {
public static void main(String[] args) throws java.io.IOException{
//ç¼åä¸ä¸ªJAVAç¨åºï¼å°èªå·±ç个人信æ¯ï¼
å¦å·ãå§åãæ§å«çï¼ä¿åå°c:\myinfo.txtæ件ä¸ã
Person p1 = new Person("0001","å°æ",22);
java.io.File file = new java.io.File("C:\\myinfo.txt");
java.io.BufferedWriter bw = new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.FileOutputStream(file)));
bw.write("å¦å·ï¼" + p1.id);
bw.write("\r\nå§åï¼" + p1.name);
bw.write("\r\næ§å«ï¼" + p1.age);
bw.flush();
bw.close();
}
}
class Person{
public String id;
public String name;
public int age;
public Person(String id, String name, int age){
this.id = id;
this.name = name;
this.age = age;
}
}
ç¨åºæå¼å¸¸ï¼è¿æå¤ææ件æ¯å¦åå¨æä¹æ²¡å¤çï¼æ²¡è¿è¡ï¼è¯·èªè¡å°è¯ããã