ASCII in Java

The program uses a for loop to iterate through the ASCII values for uppercase letters, which range from 65 to 90 (inclusive). Inside the loop, the program uses the System.out.println() method to print the ASCII value (i) and the corresponding character value ((char)i). The (char) operator is used to convert the integer ASCII value to its corresponding character.

When the program is run, it prints a list of ASCII values and characters for uppercase English letters, with each line of output showing the ASCII value followed by the corresponding character. For example, the first line of output is "65 A", which indicates that the ASCII value 65 corresponds to the letter A. The program continues in this manner, printing each letter of the alphabet in uppercase along with its corresponding ASCII value.

Source Code

public class ascii {
    public static void main(String args[])
            ASCII  -  American Standard Code For Information Interchange
            Computers can only understand numbers,
            so an ASCII code is the numerical representation of a character such as 'a' or '@' etc.
            The first 32 characters in the ASCII-table
            are unprintable control codes and are used to control peripherals such as printers.
            Codes 32-127 are common for all the different variations of the ASCII table, they are
            called printable characters, represent letters, digits, punctuation marks,
            and a few miscellaneous symbols.
            65-90  A-Z
            97-122 a-z
            48-57  0-9
            Space  32
        for(int i=65;i<=90;i++)
            System.out.println(i+" "+(char)i);


65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
To download raw file Click Here

Basic Programs