java.lang.Character.valueOf(char c)


java.lang.Character.valueOf(char c)

package com.codingdict;



import java.lang.*;



public class CharacterDemo {



   public static void main(String[] args) {



      // create 2 Character objects c1, c2

      Character c1, c2;



      // create 2 char primitives and assign values 

      char ch1 = 'i';

      char ch2 = 65;



      // assign Character values of ch1, ch2 to c1, c2

      c1 = Character.valueOf(ch1);

      c2 = Character.valueOf(ch2);



      String str1 = "Character value of " + ch1 + " is " + c1;

      String str2 = "Character value of " + ch2 + " is " + c2;



      // print c1, c2 values

      System.out.println( str1 );

      System.out.println( str2 );

   }

}