Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes The Guessing Game 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 "The Guessing Game" Watch "The Guessing Game" New topic

The Guessing Game

Spandan Pandey

Joined: Feb 20, 2013
Posts: 10
I am having a problem in the page 39 guessing game in Headfirst Java.
The command prompt is class GuessGame is public, should be declared in a file nam
public class GuessGame {
^ class Player is public, should be declared in a file named
public class Player {

So, I separately made .java file containing GuessGame class and Player classs and compiled it.
But still the isn't able to compile showing the same error.I don't understand the reason.Now I have separate class files for each of them,it must compile now.
Greg Charles

Joined: Oct 01, 2001
Posts: 2840

Welcome to JavaRanch!

If the compiler still complains that there is a public class Player defined within , then there probably is. When you created, did you also remove the Player class from Did you save your changes after removing it?
I agree. Here's the link:
subject: The Guessing Game
Similar Threads
Question about classes and running source code.
Guessing Game problem page39 Head First Java
Please Help with Guessing Game (Head First Java) cannot resolve symbol
Very new to java