aspose file tools*
The moose likes Beginning Java and the fly likes Head First Java 2nd Ed. Correction?... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java 2nd Ed. Correction?..." Watch "Head First Java 2nd Ed. Correction?..." New topic
Author

Head First Java 2nd Ed. Correction?...

Glen Kidston
Greenhorn

Joined: Feb 26, 2005
Posts: 9
Greetings Big Moosers.
I just picked up
Head First Java (2nd Edition - Covers Java 5.0)
. For the
Be the compiler
exercises A and B on page 63, the corresponding solutions (right half of page 68) indicate that these classes need to be changed to compile. This isnt what I thought when I did the exercises and was surprised to see corrections during subsequent review of the answers. Being a good sport, I typed these two exercises (three classes) into two *.java files, named
BooksTestDrive.java
and
Hobbits.java
. I then compiled them without a hitch. They dont run, but they do compile. And I understand why they get NullPointerException and ArrayIndexBoundsException respectively. Should the name/purpose of this exercise be changed from
Be the compiler
to
Be the JVM
and make the point of the exercise be to play JVM and determine how to change each of these files so that they will both compile and run without error? Thank you for reading and your time.
Sincerely,
-Glen
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Hey Glen,

:roll:

You are correct! We should have called this exercise... "Be the JVM"... although that might have been a big clue... hmmm... we'll come up with some sort of creative solution.

Anyway, thanks for a good catch! It's amazing to us that you're the first person to bring this up after a year and a half

Thanks,

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
"Be the JDK"?


"I'm not back." - Bill Harding, Twister
Glen Kidston
Greenhorn

Joined: Feb 26, 2005
Posts: 9
Hmmmm... Not bad at all. I was thinking personally that I should maybe stick to reviewing and leave the creative stuff to the authors, but maybe that's a cop out. Plus I just had gum surgery, so I'm not feeling very creative. Keep up the good work everyone! Ouch and bye....
Saravanan Jothimani
Greenhorn

Joined: Feb 25, 2005
Posts: 26
I Cant understand what you are trying to say.

Regards

Saravanan
Glen Kidston
Greenhorn

Joined: Feb 26, 2005
Posts: 9
My confusion was that the goal of these exercises was to "Be the compiler".
The thing is, the compiler does not have a problem with the coding errors in these exercises. I verified this by typing the Java programming language statements from the exercises into files called "BooksTestDrive.java" and "Hobbits.java". I then ran these two new files through the Java compiler, and it turns out that they compile (into *.class files) without any errors. The errors happen later, when you try to actually run the resulting classes (via the Java Virtual Machine). Hence the "Be the JVM" "Be the JDK" suggestions. I like the examples and their presentation, and I do hope I am not confusing matters, but I found it confusing that these programs do compile but do not run.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Java 2nd Ed. Correction?...