How to convert an ascii value to char


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.


2 comments:

  1. Thanks a lot for your answer, it was quite helpful

    ReplyDelete