File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes create file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "create file" Watch "create file" New topic

create file

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
What is the name of the file that is created by this code

Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

None. No file is created. Check out the File api to figure out which one's do.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
I understand it needs createNewFile() method

But still doesn't know what will be the name?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15080

If you call createNewFile() on the File object, it will create a file named bar in the /tmp directory.

Please read the documentation of class

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: create file
It's not a secret anymore!