Example
Convert a string to a char array:
java
String myStr = "Hello";
char[] myArray = myStr.toCharArray();
System.out.println(myArray[0]);
Definition and Usage
The toCharArray() method returns a new char array representing the contents of the string.
Syntax
java
public char[] toCharArray()
Technical Details
| Java version: | Any |
|---|