Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes File creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "File creation" Watch "File creation" New topic
Author

File creation

srikrish
Ranch Hand

Joined: Sep 12, 2000
Posts: 63
I have a doubt on file creation.
When you say File f=new File("myfile.ext"), you are only creating a reference to a file object. This does not create the actual file itself. Right? So, is there any method whereby we can create a file on the machine? I know the delete() method of File class deletes the actual file itself. Is there a similar method for the creation of the actual file itself?
Sandeep Potnis
Ranch Hand

Joined: Aug 18, 2000
Posts: 39
srikrish,
There is a createNewFile() method in the File class.
Take a look at JDK 1.2.2 API.
Sandeep
srikrish
Ranch Hand

Joined: Sep 12, 2000
Posts: 63
Thanks Sandeep.I need to work on this File class.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File creation
 
Similar Threads
.jar shortcut in windows??? an easy question im sure...
NoClassDefFoundError when deploying application on weblogic 10.3.4
Query on RHE mock exam answer
help me
B&S: Locking aproach