How to Convert Character to ASCII in Java


In this example,we will learn the method to convert character to ASCII in Java.

Source Code

package com.beginner.examples;

public class Char2ASCII {
  public static void main(String[] args) {
    char a = 'a';
    System.out.println((int)a); // convert character to ASCII
  }
}

Output:

97
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments