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

Compiler error cannot find symbol  RSS feed

 
Janice Twomey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not sure where the problem is help would be greatly appreciated



error is refering to the line public static string studentName
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and welcome to the Javaranch.

There is no such thing as string class there is however a String class. Classnames start with an uppercase character.
 
Janice Twomey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lack of sleep is catchin up with me
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Janice,

Welcome to CodeRanch!

Java is case-sensitive, and string != String.

By the way, it's this case sensitivity which makes it important to be consistent with your variable naming. The Java convention is that classes start with a capital, and methods and variables start lower case. But your Balance and Print variables start with capitals - you'd be better off fixing that while you're at it.

Edit: ah, too slow!
 
Buddhika Mawella
Ranch Hand
Posts: 40
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friend,
You use a IDE like Eclipse(http://www.eclipse.org/) to test your java programs instead of typing on notepad. Then you can easily detect these type of syntax errors.
 
Janice Twomey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've fix a good bit but I'm still getting symbol errors

 
Buddhika Mawella
Ranch Hand
Posts: 40
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your program variable 'costPerPage' and 'currentBalance' are undefined. that's why you are getting symbol errors.
 
Campbell Ritchie
Marshal
Posts: 55717
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Disagree. You are better off not using IDEs at this stage.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also disagree. This is a very simple error and the compiler will tell you exactly where it is. It's a very basic mistake and for me that is an indication that the topic starter is a beginner (nothing special here in the "Beginnning Java" forum). He should get to a level where he is able to spot such mistakes and familiarize himself with Java and its classes / api's and then consider using an IDE.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what you do need to do is tell us the lines that you're getting errors .
 
Buddhika Mawella
Ranch Hand
Posts: 40
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:But what you do need to do is tell us the lines that you're getting errors .

Yes. Agree with you. that is the better way for a beginner.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!