Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile Errors - Head First - GuessGame

 
Temmu Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've created 3 .java files - 1 compiles, 2 give errors.
The folder that the .java files are in is part of the PATH statement, as is the location of the \BIN folder.
All 3 .java files are in the same directory.
Error messages posted after each .java file.

I have read the other 3 threads about this program - does not seem applicable - but, I'm just learning.
Advice greatly appreciated!

GameLauncher.java - does NOT compile:



c:\some\path\here>javac GameLauncher.java
.\GuessGame.java:6: error: <identifier> expected
Public void StartGame()
^
.\GuessGame.java:6: error: invalid method declaration; return type required
Public void StartGame()
^
.\GuessGame.java:6: error: cannot find symbol
Public void StartGame()
^
symbol: class Public
location: class GuessGame
GameLauncher.java:6: error: cannot find symbol
game.startGame();
^
symbol: method startGame()
location: variable game of type GuessGame
4 errors




Player.java DOES compile




GuessGame.java does NOT compile:



c:\some\path\here>javac GuessGame.java
GuessGame.java:6: error: <identifier> expected
Public void StartGame()
^
GuessGame.java:6: error: invalid method declaration; return type required
Public void StartGame()
^
2 errors
 
lokesh sree
Ranch Hand
Posts: 100
Eclipse IDE Hibernate Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Java IS case sensitive. So, "Public" is not the same as the actual java keyword "public". This should solve some of your issues here.
 
Temmu Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lokesh chenta wrote:Hi,
Java IS case sensitive. So, "Public" is not the same as the actual java keyword "public". This should solve some of your issues here.


Thanks! OK, did that, now I only get this:
(I know game must be the game in the line above it in GameLauncher - it is there, but the compiler says it can't find it: )

Is this something that is so obvious I should "just see it" or "jsut get it?"

c:\some\path\here>javac GameLauncher.java
GameLauncher.java:6: error: cannot find symbol
game.startGame();
^
symbol: method startGame()
location: variable game of type GuessGame
1 error
 
John Jai
Rancher
Posts: 1776
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again case sensitive - StartGame() and not startGame()
 
Temmu Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Jai wrote:Again case sensitive - StartGame() and not startGame()


Thanks, John. So sorry, how embarrassing, am told by someone look at CASE SENSITIVITY and there is my problem again.
I trust I'll not repeat that one again!

Thanks again, Lokesh and John!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic