This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes What does this error mean?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What does this error mean??" Watch "What does this error mean??" New topic

What does this error mean??

Ammar Salem
Ranch Hand

Joined: Dec 29, 2007
Posts: 60
:\Users\The_Old_Man\Documents\ cannot find symbol
symbol : method charAt(int)
location: class java.lang.String[]
1 error

Tool completed with exit code 1

****************************<br />For Some Dreams.....<br />One Lifetime Is Not Enough.<br />****************************
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Type: String[] doesn't have a charAt method.

Maybe you meant s[index].charAt(i)?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

How is the variable, s, declared?
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Hi As per your error is saying :

you have variable s[], that means this is an array, most probably of string.

s is now here refer to array Object,rather then String Object.
you can not call charAt method with an array Object,
you can take following example for your reference ;


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44553
Agree with almost all of that, except that you oughtn't even try catching those two Exceptions there. If either occurs, you need to correct your code!
I agree. Here's the link:
subject: What does this error mean??
It's not a secret anymore!