Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error: cannot find symbol  RSS feed

 
chris guffin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, I've been reading Head First Java(around page 100) and I've come across a problem that i can't seem to fix. I have no other experience in programming aside from this book, so sorry in advance if this is a completely noob question.

I've copied some code that's in the book, but when i try to compile it i get an error that looks like this:

C:\Java>javac SimpleDotCom.java
SimpleDotCom.java:17: error: cannot find symbol
numOfHits++;
^
symbol: variable numOfHits
location: class SimpleDotCom
SimpleDotCom.java:22: error: cannot find symbol
if (numOfHits == locationCells.length) {
^
symbol: variable numOfHits
location: class SimpleDotCom
2 errors

I can't figure out why the symbol numOfHits can't be found. If you need it, here is the code:




Thanks in advance for any help,

~Chris
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch! Java is case sensitive means int age and int Age both are considered as different variables so in your code and one has character O in small and other in capital so both are different, just make small o as capital O on line number 4.
 
chris guffin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ARGHHH! I even capitalized both the 'n's in numOfHits to see if that was the problem but didn't notice my typo. Thank you so much for the help and warm welcome.
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pleasure
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!