public class CharArrayOfString { public static void main(String[] args) { // Create a string String str = "Hello JAVA"; // Display the value of string System.out.println("Length of string : " + str.length()); System.out.println("String : " + str); // Create character array of string char[] charArray = str.toCharArray(); // Calculate length of character array int len = charArray.length; // Display the length of character array. System.out.println("Length of character array : " + len); System.out.println("Element of character : "); for (int i = 0; i < len; i++) { System.out.print(charArray[i]); } } }