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// java convert array of char to string
2public class CharArrayToString
3{
4 public static void main(String[] args)
5 {
6 char[] charArray = new char[]{'F','l','o','w','e','r','B','r','a','c','k','e','t','s'};
7 String str = new String(charArray);
8 System.out.println(str);
9 }
10}
1 final char[] charArray = { 'g','e','e','k','s','f','o','r','g','e','e','k','s' };
2 String string = new String(charArray);
3
4 System.out.println(string);
5
6 // -> "geeksforgeeks"