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

Convert char to int ASCII example

  1. /*
  2.  * Convert char to int ASCII example. Program to convert char
  3.  * to int ASCII number.
  4.  */
  5.  
  6. public class CharToInt {
  7.  
  8.  public static void main(String args[]){
  9.  
  10.   char ch = 'a';
  11.    
  12.   //cast the character to convert it to int
  13.   int asciiCode = (int)ch;
  14.    
  15.   System.out.println("char converted to int ascii code: " + asciiCode);
  16.  
  17.  }
  18.  
  19. }
No votes yet
Share this

Post new comment

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