Java — How to Convert character array to a String

Many a times you need to con­vert the char­ac­ter array into a String, its quite sim­ple to do.

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

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

Method 2. String b = String.val­ueOf(x);

Out­put: Sumit

You may also like...