Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hey can I have a little help understanding symbols?

 
Cody Prince
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I'm new here, and this is my first post. I was hoping to get some help understanding the cannot find symbol error. I'm attempting to teach myself java using just my computer and a textbook called Head First Java that my school supplied to shut me up. If you could take a look at this code, copied from page 106, and tell me why I'm getting this error and what exactly it means so I can troubleshoot it in the future:

Code:




And here's the error that happens when I attempt to compile it

SimpleDotCom.java:8: error: cannot find symbol
int guess = Interger.parseInt(stringGuess);
^
symbol: variable Interger
location: class SimpleDotCom
1 error

(The carrot in the window is pointing to the I in Interger.parseInt)
Thanks In advance!
 
Henry Wong
author
Marshal
Pie
Posts: 20892
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cody Prince wrote:
And here's the error that happens when I attempt to compile it




Basically, it is saying that it doesn't know what "Interger" is.... perhaps you mean "Integer" (without the "r")??

Henry
 
Cody Prince
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't facepalm any harder.
 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I have added code tags to your post, which you should always use, and you can see how much better it looks
You should never use tabs for indenting. Always use spaces. If you get a decent text editor, you can set up options to do that automatically.
 
Cody Prince
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you! What would constitute as a decent text editor? At the moment I'm using notepad, because that's all I actually have on my laptop. Also, should I use the code for whatever errors the compiler is giving me as well?
 
Alex Petsche
Ranch Hand
Posts: 42
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally I would say, yes, use the code tags for the error messages as well as the code. It formats it for you and makes it easier to read in my opinion. I don't know if the moderators of the forums would require it, but if they do I'm sure you can probably find a thread on posting rules somewhere.

Also I use notepad++ as a text editor. I don't know if it is what Campbell Ritchie means by saying "decent text editor", but it's what I use.
 
Campbell Ritchie
Sheriff
Posts: 48404
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to beware of code tags for error messages; if the line is long, it creates left‑and‑right scroll bars, and the thread becomes very difficult to read.
Notepad is dreadful for programming; Notepad++ is excellent, however.
More comments here, here and here; those links say more or less the same thing. Remember to write backwards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic