aspose 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 Spring in Action this week in the Spring 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: 39408
    
  28
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: http://aspose.com/file-tools
 
subject: What does this error mean??