Convert Char array to String in Java

Convert Char array to String in Java Example describes about Convert Char array to String in Java.

String class have the below constructor

String string = new String(char[] value)

 

By using this constructor, you can easily build a string with provided characters

Convert Char array to String in Java

public class ConvertCharArrayToString {
 
 
public static void main(String[] args) {
   
   
char[] charValue = new char[] { 'a', 'b', 'c' };
   
    String str =
new String(charValue);
   
    System.out.println
(str);
   
 
}
}
Output
abc








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