how to initialize a string into a char array in java code example Example: convert string to char array in java String str = "example"; char[] ch = str.toCharArray();