• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The Guessing Game

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a problem in the page 39 guessing game in Headfirst Java.
The command prompt is
GameLauncher.java:1: class GuessGame is public, should be declared in a file nam
ed GuessGame.java
public class GuessGame {
^
GameLauncher.java:65: class Player is public, should be declared in a file named
Player.java
public class Player {
^

So, I separately made .java file containing GuessGame class and Player classs and compiled it.
But still the GameLauncher.java 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.
Help!!
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

If the compiler still complains that there is a public class Player defined within GameLauncher.java , then there probably is. When you created Player.java, did you also remove the Player class from GameLauncher.java? Did you save your changes after removing it?
 
reply
    Bookmark Topic Watch Topic
  • New Topic