Java program to convert Character Array to String


Program
import java.util.*; public class StringToChar{ public static void main(String[] args){ char[] ch={'W', 'e', 'l', 'c', 'o', 'm', 'e',' ' , 'T', 'o',' ' , 'F', 'r', 'e', 's', 'h', 'e', 'r', 'b', 'e', 'l', 'l'}; String str1 = String.valueOf(ch); String str2 = new String(ch); System.out.println(str1); System.out.println(str2); } }
Input
Output