how to string to char array in java code example
Example 1: java string to char array
String str = "example";
char[] ch = str.toCharArray();
Example 2: char array to string in java
// Method 1: Using String object
char[] ch = {'g', 'o', 'o', 'd', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g'};
String str = new String(ch);
System.out.println(str);