Rajinder Menu

How to convert an ascii value to char in Java


Following example shows how to convert an ascii value to its char representation.


public class AsciiToChar {

  public static void main(String[] args) {
    int ascii=65;
    char c=(char)ascii;
    System.out.println(c);
    /* OR System.out.println((char)65);*/

  }
}

Output:
A

I would like to know your comments and if you liked the article then please share it on social networking buttons.


5 comments: