java生成.dat文件并写入数据

/**

* @param args

*/

public static void main(String s[]) {

try {

String url = "F:\\gsm\\";

String FileName = "info.dat";

File file = new File(url);

file.mkdirs();//创建文件夹

File fil = new File(url);

fil.createNewFile();

 

 

FileWriter fileWriter=new FileWriter(url+FileName);

fileWriter.write("gsmc");//写入文件

fileWriter.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

你可能感兴趣的:(java)