Home > DeveloperSection > Forums > How to convert a char to a string in Java?
Jayne Spooner
Jayne Spooner

Total Post:21

Points:147
Posted on    August-02-2015 11:24 PM

 Java Java  String 
Ratings:


 1 Reply(s)
 437  View(s)
Rate this:
I have a char and I need a String. How do I convert from one to the other?


Mayank Tripathi
Mayank Tripathi

Total Post:397

Points:3117
Posted on    August-03-2015 12:44 AM

Here are various ways to convert char into String:

String stringValueOf = String.valueOf('c');

String characterToString = Character.toString('c');

String characterObjectToString = new Character('c').toString();

.String concatBlankString = 'c' + "";

String fromCharArray = new String(new char[]{x});

Don't want to miss updates? Please click the below button!

Follow MindStick