It is very simple program to convert string to char array in java. You have to just use valueOf( ) method to convert string to char array. In the following program I have create one class known as strtochar class. After that I have create one variable of array known as "chs" and I have place some value on it. After that I have pass this variable to valueOf( ) method.
Code:
public class strtochar
public static void main(String[] arg) {
char[] chs = {'x','y','z','l'};
System.out.println(String.valueOf(chs));
}
}
Bookmarks