Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

convert char to string in java

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #char #string #java
ADD COMMENT
Topic
Name
7+7 =