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 





Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions


We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.