permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Will FileReader create a new file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Will FileReader create a new file?" Watch "Will FileReader create a new file?" New topic
Author

Will FileReader create a new file?

Benjamin Samuel
Ranch Hand

Joined: Dec 15, 2006
Posts: 33
K&B Book states that

Specifically, create a FileReader, a FileWriter, a PrintWriter, a FileInputStream, or a FileOutputStream. Whenever you create an instance of one of these classes, you automatically create a file, unless one already exists...


But when I create an instance of FileReader, i get a FileNotFoundException if the file does not exist before. Code follows:

Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
No, this is a bug in the book. Search this forum for topics that discuss this.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
jQuery in Action, 2nd edition
 
subject: Will FileReader create a new file?
 
Similar Threads
File q, help requested!
I found something wrong form K&B chapter 6
FileReader question
Files
createNewFile()