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