Java toCharArray() Method
The toCharArray() method converts the string into a character array.
Syntax
public char[] toCharArray()
Parameters
-
None
Return Value
The character array.
Example
public class Test {
public static void main(String args[]) {
String Str = new String("www.runoob.com");
System.out.print("返回值 :" );
System.out.println( Str.toCharArray() );
}
}
The execution result of the above program is:
返回值 :www.runoob.com
Java String class