- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating String Object from Character Array in Java
Here is our character array.
char[] ch = { 'T', 'E', 'S', 'T'};
To create string object from the above character array is quite easy. Add the array to the string parameter as shown below −
String str = new String(ch);
Example
public class Demo { public static void main(String[] args) { char[] ch = { 'T', 'E', 'S', 'T'}; String str = new String(ch); System.out.println(str); } }
Output
TEST
- Related Articles
- Creating String Object from certain part of a character Array in Java
- Java Program to create Character Array from String Objects
- Creating a string from a subset of the array elements in Java
- Difference between String and Character array in Java.
- Remove a character from a Java StringBuffer object
- how to convert Object array to String array in java
- Java program to convert a character array to string
- Sort String Array alphabetically by the initial character only in Java
- Creating a JavaScript Object from Single Array and Defining the Key Value?
- Append a single character to a string or char array in java?
- How to remove the last character from a string in Java?
- How to remove all common character from string array elements in android?
- Convert string to character array in Arduino
- Convert character array to string in Arduino
- Java program for removing n-th character from a string

Advertisements