If you want to convert a string into character array, java provides a method .toCharArray() [this returns a character array], let’s see the implementation
public class CharString { public static void main(String[] args) { String myStr = new String("Welcome"); char[] chars; System.out.println("Individual characters - "); chars = myStr.toCharArray(); for(int i=0 ; i < chars.length ; i ++) { System.out.println(chars[i]); } } }
Output:
Individual characters - W e l c o m e