xxxxxxxxxx
String s = "a";
char c = s.charAt("0");
xxxxxxxxxx
char c = 'a';
String s = String.valueOf(c); // fastest + memory efficient
String s = Character.toString(c);
String s = new String(new char[]{c});
String s = String.valueOf(new char[]{c});
String s = new Character(c).toString();
String s = "" + c; // slowest + memory inefficient
xxxxxxxxxx
String string = "ABCDEF" ;
char[] charsFromString = string.toCharArray(); // { 'A', 'B', 'C', 'D', 'E', 'F' }
xxxxxxxxxx
// getting single character from string..
String str="abcd";
char c=str.toChar(0);
System.out.println("output is "+c); // output is a
xxxxxxxxxx
char[] chars = { 'A', 'B', 'C', 'D', 'E', 'F' };
String str1 = String.valueOf(chars); //"ABCDEF"
String str2 = new String(chars);// "ABCDEF"
System.out.println(str1.equals(str2)); //"true"
xxxxxxxxxx
// If your string contains exactly one character the simplest way to convert it
// to a character is probably to call the charAt method:
char c = s.charAt(0);
// For more than one character:
char[] c = s.toCharArray();