Convert Character array to string in Java

后端 未结 10 2015
野的像风
野的像风 2021-02-05 16:59

I have a Character array (not char array) and I want to convert it into a string by combining all the Characters in the array.

I have tried the following f

10条回答
  •  一个人的身影
    2021-02-05 17:16

    First convert the Character[] to char[], and use String.valueOf(char[]) to get the String as below:

        char[] a1 = new char[a.length];
        for(int i=0; i

提交回复
热议问题