public class Txt(){
public void Text() throws FileNotFoundException{
File file = new File("C://Users//admin//Desktop//test.txt");
PrintWriter pw = new PrintWriter(file);
pw.close();
}
public static void main(String [] ages) throws IOException{
Txt txt = new Txt();
txt.Text();
}
}
看过网上一些在本地创建txt文件的方法 感觉我自己写的这个比较容易理解和简单