1char[] a = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'};
2String str = new String(a);
1char[] arr = { 'p'," ",'q', 'r', 's' };
2 String str = String.valueOf(arr);
3 System.out.println(str);//"p qrs"
1// Convert char array to String in Java
2class Util
3{
4 public static void main(String[] args)
5 {
6 char[] chars = {'T', 'e', 'c', 'h', 'i', 'e', ' ',
7 'D', 'e', 'l', 'i', 'g', 'h', 't'};
8
9 String string = new String(chars);
10 System.out.println(string);
11 }
12}
13
1String x2 = "hello";
2String newSortedString = "";
3Object[] y = x2.toLowerCase()
4 .chars()
5 .sorted()
6 .mapToObj(i -> (char) i)
7 .toArray();
8
9for (Object o: y) {
10 newSortedString = newSortedString.concat(o.toString());
11}
12
13System.out.println(newSortedString);