C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » Java programs » Java basic programs

Java program to print uppercase and lowercase alphabets

In this java program, we are going to print uppercase and lowercase alphabets from A to Z and a to z using loop, it’s a very simple program demonstrating use of lopping with alphabets as loop counter.
Submitted by IncludeHelp, on November 02, 2017

Example:

Uppercase alphabets:
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 
Lowercase alphabets:
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

Program to print alphabets in java

public class PrintAlphabets 
{
	public static void main(String args[])
	{
		char ch;

		//printing uppercase alphabets 
		System.out.println("Uppercase alphabets:");
		for(ch='A';ch<='Z';ch++)
			System.out.print(ch + " ");

		//printing new line
		System.out.println("");

		//printing lowercase alphabets 
		System.out.println("Lowercase alphabets:");
		for(ch='a';ch<='z';ch++)
			System.out.print(ch + " ");		
	}
}

Output

Uppercase alphabets:
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 
Lowercase alphabets:
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 








COMMENTS