java.lang.Character.toString()


java.lang.Character.toString()

package com.codingdict;



import java.lang.*;



public class CharacterDemo {



   public static void main(String[] args) {



      // create 2 Character objects c1, c2

      Character c1, c2;



      // assign values to c1, c2

      c1 = new Character('h');

      c2 = new Character('5');



      // create 2 String objects s1, s2

      String s1, s2;



      // assign String values of c1, c2 to s1, s2

      s1 = c1.toString();

      s2 = c2.toString();



      String str1 = "String value of " + c1 + " is " + s1;

      String str2 = "String value of " + c2 + " is " + s2;



      // print s1, s2 values

      System.out.println( str1 );

      System.out.println( str2 );

   }

}