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 charAt used on arraylist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "charAt used on arraylist" Watch "charAt used on arraylist" New topic
Author

charAt used on arraylist

Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 102
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
Sheriff

Joined: Sep 28, 2004
Posts: 19064
    
  40


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?


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 193

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.


Do not wait to strike till the iron is hot; but make it hot by striking....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: charAt used on arraylist