Convert String to Char Array in Java

Sometimes we might need to Convert String to Char Array. String class in Java provides toCharArray() method to convert String to Char Array.

The syntax of toCharArrray() method is as follow:

toCharArray() method returns character array whose length is the length of this string and this array contains the character sequence represented by this String.

Convert String to Char Array with an Example :

Let’s see String to char array conversion with an example. Let’s take a string “This is a String.”

Output:

Want to know about how to convert String to int in Java, then read tutorial on Convert String to int in Java.