File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What does this error mean??

 
Ammar Salem
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:\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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Type: String[] doesn't have a charAt method.

Maybe you meant s[index].charAt(i)?
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the variable, s, declared?
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic