View Full Version : Java; How do I print the *individual* characters of array element/s?

November 7th, 2010, 06:42 PM
Hi folks. I am looking to be able to print the individual characters from an array element - if someone would be so kind as to show me how? This is my test piece:

public class Filter{

public static void main(String args[]){
for(int i=0;i<args.length;i++){

Thank you :)

November 7th, 2010, 07:33 PM
Your array element is a String, yes?

So you need to print individual characters from a String object?

Have you looked in the JavaDoc to see if there is anything that could help you?

java.lang.String (http://download.oracle.com/javase/6/docs/api/java/lang/String.html)

November 8th, 2010, 02:13 AM
Then loop through your char array :)
further information on 'toCharArray' is in the String api as r-senior kindly linked you too.

November 8th, 2010, 07:59 PM
Thanks guys :)

Once I get over the teething period I'll be fine. I have grasped the basics now, it's just the obvious things that always throw me; isnt that always the way? :)