1// Convert char to string java
2public class CharToStringJava
3{
4 public static void main(String[] args)
5 {
6 char ch ='G';
7 String str = Character.toString(ch);
8 System.out.println("char to string is: " + str);
9 }
10}
1char[] chars = { 'A', 'B', 'C', 'D', 'E', 'F' };
2
3String str1 = String.valueOf(chars); //"ABCDEF"
4String str2 = new String(chars);// "ABCDEF"
5
6System.out.println(str1.equals(str2)); //"true"
1from character to string:
2 char c = 'a';
3 String s = Character.toString(c);
4 //s == "a"