
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create 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
Advertisements