- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Java program to convert a list of characters into a string
A list of characters can be converted into a string by iterating through the list of characters and using a StringBuilder class to create a string.
A program that demonstrates this is given as follows.
Example
import java.util.Arrays; import java.util.List; public class Example { public static void main(String[] args) { List<Character> cList = Arrays.asList('B', 'e', 'a', 'u', 't', 'y'); StringBuilder sb = new StringBuilder(); for (Character c : cList) { sb.append(c); } String str = sb.toString(); System.out.println("The string obtained is: " + str); } }
Output
The string obtained is: Beauty
Now let us understand the above program.
First, the character list is specified. Then the StringBuilder class is used to create a string by iterating through the list of characters and appending them. Finally, the string str is displayed. The code snippet that demonstrates this is given as follows −
List<Character> cList = Arrays.asList('B', 'e', 'a', 'u', 't', 'y'); StringBuilder sb = new StringBuilder(); for (Character c : cList) { sb.append(c); } String str = sb.toString(); System.out.println("The string obtained is: " + str);
- Related Articles
- C# program to convert a list of characters into a string
- Convert a String to a List of Characters in Java
- How to convert a list of characters into a string in C#?
- Convert List of Characters to String in Java
- How can we convert a list of characters into a string in Python?
- Java Program to convert Properties list into a Map
- Java Program to Convert a List of String to Comma Separated String
- Java Program to Convert a String into the InputStream
- Convert a string representation of list into list in Python
- How to convert an array of characters into a string in C#?
- Program to convert List of Integer to List of String in Java
- Program to convert List of String to List of Integer in Java
- Convert a String into a square matrix grid of characters in C++
- Convert String into comma separated List in Java
- Java Program to convert a string into a numeric primitive type using Integer.valueOf()

Advertisements