Java – How to Convert character array to a String

Many a times you need to convert the character array into a String, its quite simple to do.

char[] x = {‘s’,’u’,’m’,’i’,’t’};

Method 1. String a = new String(x);

Method 2. String b = String.valueOf(x);

Output: Sumit

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *