incompatible types *** have to convert String into char sequence

The problem is i cant convert the string to char sequence using subSequence() .... I get the following error ... give me the solution ..

public class StrToChar

{

public static void main(String args[])

{

String str = args[0];

int slength = args[0].length();

char c[]=new char[slength];

for(int i=0;i<slength;i++)

{

c=str.subSequence(i,i+1);

System.out.println(c);

}

} }

The error is ...

StrToChar.java:14: incompatible types

found: java.lang.CharSequence

required: char

c=str.subSequence(i,i+1);>

[638 byte] By [Manisekara] at [2007-11-26 17:12:03]
# 1

Try this :

public class NewClass {

/** Creates a new instance of NewClass */

public NewClass() {

String S ="Test";

char[]charArray = new char[20];

S.getChars(0,S.length(),charArray,0);

for(int i=0;i<S.length();i++){

System.out.println(charArray[i]);

}

}

public static void main(String[] args){

new NewClass();

}

}

>

vettenburga at 2007-7-8 23:39:56 > top of Java-index,Java Essentials,New To Java...