This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Head First Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java" Watch "Head First Java" New topic
Author

Head First Java

Ben Jones
Greenhorn

Joined: Oct 04, 2007
Posts: 16
Hey all, I'm currently new(ish) to Java and I bought the above book (Head-First Java) and I've gotten on to the battleships game section.

However, when I declare a Array list of DotComs' I keep getting errors, I've been over the code about 4 times looking for mistakes I've made but I've corrected them and still the errors persist.

Has anyone else using this book managed to work out why this happends?

Dan Brownlow


Dan Brownlow
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3720
    
  16
I haven't read the book, but from other posts on here I know some of the code samples are not complete. Check the text of the book to see if this is an example of that. You could also search these forums to see if other people have had similar problems. I think I remember the battleships program being mentioned before but I'm not sure what the exact problem was.
If none of that helps, post the error messages you are getting and the bit of your code they refer to and I'm sure someone will be able to spot the problem.


Joanne
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
If you write the code here, may be people will help you resolve the compile time issues.


Amit Tank
Linked In
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11441
    
  16

also, post the EXACT text of the errors. that actually tells you what's wrong, once you learn how to read it (which isn't really all that hard).


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ben Jones
Greenhorn

Joined: Oct 04, 2007
Posts: 16
I went to the site and downloaded the JAR file and it didn't work, but after fiddling around for a while.. It's magically started working although I'm not 100% sure why. Yea', I know how to read the errors the compiler throws at me, spent a lot of time on google searching for what errors I got meant.

I'll keep trying to figure out what changed so if anyone has similar problems, they'll know how to fix it!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Head First Java