• Post Reply Bookmark Topic Watch Topic
  • New Topic

When is the file created?  RSS feed

 
Sabrina Kaur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please consider the following:

------------------------------
FileWriter fw = new FileWriter("C:"+File.separator+"Training"+File.separator+"Week3"+File.separator+"sat"+File.separator+"my.txt");

BufferedWriter bw = new BufferedWriter(fw);

------------------------------

What I would like to know is that at what point is the file 'my.txt' actually being created??

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Sabrina kr", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff
 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you do a new File(), the file is created. What are you trying to do ?

- Harjit
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"new File(...)" does not create a file.

The FileWriter constructor creates the file; this is also discussed in its javadocs.
 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats what I meant... I didn't read what constructor was used.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!