GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes File wouldnt compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "File wouldnt compile" Watch "File wouldnt compile" New topic
Author

File wouldnt compile

Jose Kampilan
Greenhorn

Joined: Aug 04, 2012
Posts: 11
Hi.

I'm currently having a problem with compiling an exercise from Head First: Java. I think all needed classes for the game to run have been compiled except for the main method.

Here's the main method (just copied it directly from the book):



And here's the error message from the compiler:



Not sure what i did wrong here.
Carey Brown
Ranch Hand

Joined: Nov 19, 2001
Posts: 174

Is main() enclosed in a class ?
Jose Kampilan
Greenhorn

Joined: Aug 04, 2012
Posts: 11
Carey Brown wrote:Is main() enclosed in a class ?


(Sorry. still new with Java.)

oh. i have to put it inside a class first? will try that.
Jose Kampilan
Greenhorn

Joined: Aug 04, 2012
Posts: 11
Huzzah. It worked.

Thanks Carey Brown.
 
GeeCON Prague 2014
 
subject: File wouldnt compile