Forums Register Login

Doubt K&B SCJP 5 pg. 440 File Creation

+Pie Number of slices to send: Send
In 3rd para: "...constructing a Reader or Writer will automatically create a file for you..."

Should perhaps read: "...constructing a FileWriter or PrintWriter will automatically create a file for you..."

(Readers don't create files, nor do most Writers.)
+Pie Number of slices to send: Send
Sorry to nitpick again. Page 458, "Working with Dates", reads:

With the help of the Locale class you'll be able to convert a date like "10/08/2005" to "Segunda-feira, 8 de Outubro de 2005" in no time.

Should instead read:

With the help of the Locale class you'll be able to convert a date like "10/08/2005" to "S�bado, 8 de Outubro de 2005" in no time.

Since October 8, 2005 was actually a Saturday.
+Pie Number of slices to send: Send
Also on the next page (465), 2nd para from bottom reads in part:

"Notice that because we were using a SHORT style, we lost some precision when we converted the Date to a String."

The above statement is wrong. The time component was "lost" because getDateInstance() was used instead of getDateTimeInstance(). The SHORT style has nothing to do with it.
+Pie Number of slices to send: Send
In pg. 563 (Using Maps) the comparison in the code segment "((Dog)o).name == name" should perhaps be rewritten using equals() instead. Otherwise the comparison may fail if a non-literal String was used to construct the Dog object.
+Pie Number of slices to send: Send
Good catches Ade - noted, thanks!
+Pie Number of slices to send: Send
 

Originally posted by Ade Barkah:
In 3rd para: "...constructing a Reader or Writer will automatically create a file for you..."

Should perhaps read: "...constructing a FileWriter or PrintWriter will automatically create a file for you..."

(Readers don't create files, nor do most Writers.)



...or a FileOutputStream
+Pie Number of slices to send: Send
Hey Septimiu,

We appreciate eagle eyes looking for errors and improvements, thanks!

BUT, this thread was almost 2 years old Since then, we've fixed errata in the book, it's been reprinted a couple of times, and most recently there is a whole new edition!

The bottom line is that it's almost never a good idea to resurrect an old thread like this. Far better to just start a new thread!

Thanks,

Bert
To get a wish, you need a genie. To get a genie, you need a lamp. To get a lamp, you need a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 839 times.
Similar Threads
I found something wrong form K&B chapter 6
java.io.package
Doubt on Load on startup tag and Meta-inf
Barry Boone (BB) Q38 FileOutputStream
FileWriter and FileOutputStream:confused:
FileReader creates a file ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:21:56.