Linux Tutorial
Characters are stored as ASCII format in java programming.
In this java program, we will learn how to print the Alphabets using ASCII characters and ASCII values.
here we are also going to see how to print capital or upper alphabet characters and lower alphabet characters.
import java.io.*; class Alphabets { public static void main (String arcs []) { char c; // prints capital alphabets for(c = 'A'; c <= 'Z'; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); // prints lower alphabets for(c = 'a'; c <= 'z'; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); // prints capital and lower alphabets, and also few symbols between alphabets characters for(c = 'A'; c <= 'z'; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); // prints capital alphabets for(c = 65; c <= 90; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); // prints lower alphabets for(c = 97; c <= 122; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); // prints capital and lower alphabets, and also few symbols between alphabets characters for(c = 65; c <= 122; ++c) { System.out.print(c); System.out.print(" "); } System.out.println(); } }
Output:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z
[ \ ] ^ _ ` these symbols are having ASCII values between 91 to 96.
ASCII values 65 to 90 are capital alphabet characters.
ASCII values 97 to 122 are lower alphabet characters.
Linux Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page