• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

charAt used on arraylist

 
Dustin Schreader
Ranch Hand
Posts: 102
  • 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: 21022
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 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: 198
Java Linux Oracle
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic