- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 PrintWriter 对象
文件,如下所示:
PrintWriter pwriter = new PrintWriter("abc.txt");
如果文件名 abc.txt
不存在,请告诉我是否会创建该文件。
我已经尝试过了,但它没有创建文件。但我想确认是否预期不创建该文件。
最佳答案
来自javadoc :
fileName - The name of the file to use as the destination of this writer. If the file exists then it will be truncated to zero size; otherwise, a new file will be created. The output will be written to the file and is buffered.
关于java - 如果文件不存在,PrinterWriter 是否会创建该文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40276888/
我正在使用 PrintWriter 对象 文件,如下所示: PrintWriter pwriter = new PrintWriter("abc.txt"); 如果文件名 abc.txt 不存在,请告
我的应用程序提示用户输入一个文本文件,mixed.txt,其中包含 12.2 安德鲁 22 西蒙 苏菲33.33 10 弗雷德 21.21 汉克 坎迪斯12.2222 接下来,应用程序将PrintWr
imageToPPMFile(picture,ysize,xsize,maxIntensity,fname); }//end of main// public static void imageToP
这个问题在这里已经有了答案: 关闭 12 年前。 Possible Duplicate: Does closing the BufferedReader/PrintWriter close the
这是我要使用的提示(我通过将行“File input = new File(args[0]);”替换为“File input = new File("data.txt");”得到了预期的结果,但我想知
我是一名优秀的程序员,十分优秀!