Convert char Array to String in Java

      No Comments on Convert char Array to String in Java




char array can be converted to String in java by passing the char array in the constructor of String.

Constructor of String:

String(char []value)

The below demo program explains how to convert char Array to String in Java.

package com.masterjavatutorial;

public class TestExample {
	public static void main(String[] args){
		char ch[] = {'a','c','r','t','w'};
		String str = new String(ch);
		System.out.println(str); 
 	}
			
}

Output of the above program is as below:

acrtw