wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes I found something wrong form K&B chapter 6 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 "I found something wrong form K&B chapter 6" Watch "I found something wrong form K&B chapter 6" New topic

I found something wrong form K&B chapter 6

Jack Crifer

Joined: May 18, 2008
Posts: 29
In Working with Files and Directories

Create a Reader or a Writer or a Stream. 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, for instance

I think just like FileInputStream,FileReader ,those INPUT funtion never created any file which is not exist.
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Be careful when putting something like this up, I have done that many times and most usually it results in wasted time. If you can show us the code that fails to createFile(), we can run the tests that duplicate the failure.

Be sure to run it several times before showing us.

"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

Given just the quote you've shown, without any context, you are absolutely right. Constructing a FileReader or FileInputStream will never create a new file. Check the errata page for the book -- this is most likely a known issue.

[Jess in Action][AskingGoodQuestions]
Jack Crifer

Joined: May 18, 2008
Posts: 29
Hi,Ernest. where I can get the errata table for the book.

Best Regards.
Bert Bates

Joined: Oct 14, 2002
Posts: 8805
You can find the link to the errata page at the top of this very forum

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Don't get me started about those stupid light bulbs.
subject: I found something wrong form K&B chapter 6
Similar Threads
FileReader question
Creating an actual file
Will FileReader create a new file?
File IO