Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Convert char to String example

  1. /*
  2.  * Convert char to String example. Program to convert char
  3.  * to String.
  4.  */
  5.  
  6. public class CharToString {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   char ch = 'e';
  11.    
  12.   //to convert char to String use static toString method of Character class.
  13.   String strCh = Character.toString(ch);
  14.    
  15.   System.out.println("char converted to String: " + strCh);
  16.  
  17.  }
  18.  
  19. }
No votes yet
Share this

Post new comment

5 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.