Java String toCharArray()

The syntax of the toCharArray() method is:

string.toCharArray()

Here, string is an object of the String class.


toCharArray() Parameters

The toCharArray() method doesn't take any parameters.


toCharArray() Return Value

  • returns a char array

Example: Java String toCharArray()

Here, the length of the char array result will be equal to the length of the string str.