Let’s learn java String toCharArray() method.
Java String toCharArray() method
Java String toCharArray() method converts given string into new character array.

Syntax
public char[] toCharArray()
Return
Returns a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
Let’s see example on Java String toCharArray() method.
public class StringToCharArrayDemo { public static void main(String[] args) { String strInput = new String("Flower Brackets"); // using toCharArray() method java char[] chArray = strInput.toCharArray(); System.out.println("Character array: "); for(char ch : chArray) { System.out.println(ch); } } }
Output:
Character array:
F
l
o
w
e
r
B
r
a
c
k
e
t
s
Also read – major features of java