小编bal*_*ala的帖子

使用java创建文件后,其中没有值

我用java创建了文件,代码如下

String Filecontent= "hei";
Run Code Online (Sandbox Code Playgroud)

创建文件

PrintWriter writer=new PrintWriter("D://balanworkspace//Coretest//Corejavatest//src//intvquestest//mydet3_8.txt","UTF-8"); 
Run Code Online (Sandbox Code Playgroud)

打印字符串

System.out.println(Filecontent); 
Run Code Online (Sandbox Code Playgroud)

写入文件

writer.println(Filecontent); 
Run Code Online (Sandbox Code Playgroud)

当我打开文件时,没有值.为什么会这样?

java file

2
推荐指数
1
解决办法
28
查看次数

标签 统计

file ×1

java ×1