Java Program to Print Alphabets (A-Z and a-z) - The Coding Shala
Home >> Java Programs >> Print Alphabets
Other Posts You May Like
In this post, we will learn how to display alphabets using the Java program.
Java Program to Print Alphabets
Write a Java program to print the alphabets (A-Z and a-z). We can use a for loop or while loop to print the alphabets.
Java Program:
/** * https://www.thecodingshala.com/ */ public class Main { public static void main(String[] args) { System.out.println("A-Z alphabets are: "); for(char ch = 'A'; ch <= 'Z'; ch++) { System.out.print(ch + " "); } System.out.println(); System.out.println("a-z alphabets are: "); for(char ch = 'a'; ch <= 'z'; ch++) { System.out.print(ch + " "); } } }
Output:
A-Z alphabets are: 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-z alphabets are: 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
- Java Program to Find the Sum of Digits of a Number
- Java Program to Add Two Numbers
- Basic Calculator Program in Java
- Java Program to Generate Random Numbers
- Java Program to Reverse an Array
Comments
Post a Comment