File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What does this error mean??" Watch "What does this error mean??" New topic
Author

What does this error mean??

Ammar Salem
Ranch Hand

Joined: Dec 29, 2007
Posts: 60
:\Users\The_Old_Man\Documents\Reverse.java:13: cannot find symbol
symbol : method charAt(int)
location: class java.lang.String[]
System.out.println(s.charAt(i));
^
1 error

Tool completed with exit code 1


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

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!
sunny


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

Joined: Oct 13, 2005
Posts: 38519
    
  23
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!
 
Consider Paul's rocket mass heater.
 
subject: What does this error mean??