File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Head First Java Problem 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 » Java » Beginning Java
Bookmark "Head First Java Problem" Watch "Head First Java Problem" New topic

Head First Java Problem

Felix Black

Joined: May 15, 2007
Posts: 8
Ok guys... ive been struggling witht his for a few hours now.... and i dont have much hair left.

I have copied the code for the "battleships" game out of head first Java... and checked it.... and checked it... and checked it again.

I cant get one of the classes to compile... and i cant see why.

I went to the Sun forums, and saw the exact same prolemn someone else was having... and they just got abused, called stupid, and told to do some research ... so please..... dont be mean to me... im trying my hardest.

here is the block of code that wont compile.

this gives me 13 identical errors refering to different parts of my code, reading : "class, enum or interface expected"

Can anybody save my hair before i need a toupe please??

thanks in advance chaps and chapettes
Felix Black

Joined: May 15, 2007
Posts: 8
Right.... ive got it working.... i put the main() method inside a class and it compiled straight away... however.... i could not get the following code to compile, even when i put it in a class:

howecer...... despite this file NOT compiling, it seems to be required for the program to run, if its not in the directory with the class files then the program throws a runtime error, but if it is there (even uncompiled) everything goes smoothly.

This is really messing my head up now.

Does this means ome files do not need to be compiled in oprder for them to work ?
Felix Black

Joined: May 15, 2007
Posts: 8
bah ! ignore me.... i must have done something wierd... it all seems to work properly now
Consider Paul's rocket mass heater.
subject: Head First Java Problem
Similar Threads
Help with code
First question in Beginners forum ...
Head first java - chapter 5 SimpleDotCom game
HeadFirst DotComBust... Help?
HFJ 2nd - Problem with SimpleDotCom