Convert char array to string in java

We can use the String.valueOf() to convert a char array to string, but some times we need to specify the part of array to be copied, in this case, we can use String.copyValueOf() to do it.
First,let’s show you the example that convert a char array to string by String.valueOf() ;

The output is

Let us see another example that use copyValueOf() method that convert char array to string.

The output is

Related articles

Convert string to int in Java
Reverse a string in java