Char Array to String Java Program

In this post we will learn and execute a simple program to convert char array to string java program.

In this program we will be using String(Char[] ch) constructor of Java String class. So, let’s see the example

Example: Char Array to String Java Program

Also Read – Convert Binary Number To Decimal Number in Java

public class CharArray_To_String {

public static void main(String[] args) {

char[] c_Array = new char[]{'F','l','o','w','e','r','B','r','a','c','k','e','t','s'};

String str = new String(c_Array);

System.out.println("The converted Char Array to String is: " + str);
}
}

Output:

Char Array to String Java Program

About the author

admin

View all posts

Leave a Reply

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