• Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot find symbol  RSS feed

 
Ryan Gordon
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I was wondering if someone can help me figure out an error message that goes with this code



this one compiles correctly, the problem im having is



error is C:\Users\Administrator\Desktop\Comp 268>javac AddressBookTest1.java
AddressBookTest1.java:127: error: cannot find symbol
                System.out.println(Contact3.getmiddleName.charAt(0).equalsContact4.getmiddleName.charAt(0));
                                           ^
  symbol:   variable getmiddleName
  location: variable Contact3 of type AddressBook1
1 error

any ideas? thank you very much.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is case sensitive. Check the name of the method carefully.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice also that the error message says "variable" not "method" and ask yourself "Why does the compiler think I'm trying to access a variable instead of a method?"
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid there is something wrong with using Strings for everything. Surely yearsParticipated is a number. Maybe the website is a URL, but I think neither shou‍ld be a String.
 
Ryan Gordon
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why I am the error saying variable and not method?
 
Ryan Gordon
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is***
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the error message, formatted with a monospaced font (this is important):
The caret sign (^) is pointing to the spot that the compiler thinks is the start of the error.  Does that help?  Or what if you look at the two very similar lines next to each other, one with a syntax error and the other without:

The reason I'm giving you hints instead of just telling you (and I will just tell you if you can't figure it out) is because interpreting and fixing errors in your code is an important skill.  BTW, the second line has two syntax errors, so after you fix the first, there will be another.
 
Ryan Gordon
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I appreciate you helping like that, I'm on my phone right now so I can't be 100% sure but I think I'm missing () for each contact?
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, and the .equals() method needs parentheses too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!