Java Program to Print ASCII Value of All Alphabets

Here is a Java program to print ASCII Value of all characters. ASCII value is the integer value corresponding to an alphabet. Every alphabet in java programming language is stored as it's ASCII value in memory location. When we store a character in a variable of data type char, the ASCII value of character is stored instead of that character itself.

For Example,
ASCII value of 'A' is 65
ASCII value of 'S' is 83

A character and it's ASCII value can be used interchangeably. The ASCII value of alphabets are consecutive natural numbers. We can perform all arithmetic operations on characters line 'B' + 3, 'B'/4 etc. If any expression contains a character then it's corresponding ASCII value is used in expression.

Java program to print ASCII value of all characters

package com.tcc.java.programs;

public class AsciiValue {
    public static void main(String args[]) {
        int i;
        for(i = 0; i < 26; i++){
            System.out.println((char)('A'+i) + " --> " + ('A'+i));
            
         }
    }
}
Output
A --> 65
B --> 66
C --> 67
D --> 68
E --> 69
F --> 70
G --> 71
H --> 72
I --> 73
J --> 74
K --> 75
L --> 76
M --> 77
N --> 78
O --> 79
P --> 80
Q --> 81
R --> 82
S --> 83
T --> 84
U --> 85
V --> 86
W --> 87
X --> 88
Y --> 89
Z --> 90

Recommended Posts
Java Program to Print Fibonacci Series with and without using Recursion
Java Program to Print Prime Numbers between 1 to 100
Java Program to Print Multiplication Table of Number
Java Program to Check If a Year is Leap Year or Not
Java Program to Convert Celsius to Fahrenheit
Java Program to Convert Decimal to Binary Numbers
Java Program to calculate area and circumference of circle
Java Program to Print Pascal Triangle
Java Program to Print Pyramid Pattern of Stars
Java Program to Find Length of a String
Java Program to Check Whether a Number is Palindrome or Not
All Java Programs