xxxxxxxxxx
char mChar = 'l';
String s = Character.toString(mChar);
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
from character to string:
char c = 'a';
String s = Character.toString(c);
//s == "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
string temp = "cat";
char * tab2 = new char [temp.length()+1];
strcpy (tab2, temp.c_str());