开发者

Deleting random access file in java

开发者 https://www.devze.com 2023-01-18 03:13 出处:网络
I\'ve created a random access file as follows: RandomAccessFile aFile = null; aFile = n开发者_Go百科ew RandomAccessFile(NetSimView.filename, \"rwd\");

I've created a random access file as follows:

 RandomAccessFile aFile = null;
 aFile = n开发者_Go百科ew RandomAccessFile(NetSimView.filename, "rwd");

I want to delete the file "afile". can anyone suggest me how to do it?


You can do that:

File f = new File(NetSimView.filename);
f.delete();

Edit, regarding your comment:

The parameter NetSimView.filename seems to be a File and not a String that contains the path to the file. So simply do:

NetSimView.filename.delete();
0

精彩评论

暂无评论...
验证码 换一张
取 消