• Post Reply Bookmark Topic Watch Topic
  • New Topic

New file not created exception handling  RSS feed

 
Kejal Shah
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!

While creating a new file, what exception (if any) is thrown if the file is not able to be created?

How do i write a good program which will take care of this?
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the API for java.lang.File.createNewFile()

What exceptions does it say the method could possibly throw?

So your code to deal with this would look something like this:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!