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

charAt used on arraylist

 
Dustin Schreader
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get characters from or actually just single letters from an arraylist. Am I able to use charAt on an array list, I'm getting an error when I try it: cannot find symbol on lines 73, 75, 77, 79. Should I use substring instead?
 
Henry Wong
author
Marshal
Pie
Posts: 20828
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The JavaDoc would be good here... the java.util.ArrayList class doesn't have a charAt() or a substring() method.

Henry

Dustin Schreader wrote:I'm trying to get characters from or actually just single letters from an arraylist. Am I able to use charAt on an array list, I'm getting an error when I try it: cannot find symbol on lines 73, 75, 77, 79. Should I use substring instead?
 
Manoj Kumar Jain
Ranch Hand
Posts: 195
Java Linux Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
charAt() and subString() are the operation those belongs to String, these can't applied on Arraylist. These methods make no sense with ArrayList.
fetch the string from the Arraylist and then you can apply these methods.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic