HomeJavaJava Program to Display Characters from A to Z Using Loop

Java Program to Display Characters from A to Z Using Loop

In this Java program, you’ll learn how to display characters from A to Z using loop using the Java programming language.   

How to Display Characters from A to Z Using Loop? 

Example 1: Display lowercase alphabet 

RUN CODE SNIPPET
class Main { 
  public static void main(String[] args) { 
    char e; 
    for(e = 'a'; e <= 'z'; ++e) 
      System.out.print(e + " "); 
    } 
}

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

Example 2: Display uppercase alphabet 

RUN CODE SNIPPET
class Main { 
  public static void main(String[] args) { 
    char e; 
    for(e = 'A'; e <= 'Z'; ++e) 
      System.out.print(e + " "); 
    } 
}

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

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Java is a popular programming language that is used to develop a wide range of applications. If you are a...
  • Java
  • March 6, 2023
Java is a programming language and computing platform that is used to create various types of applications. It is used...
  • Java
  • March 6, 2023
In this post, you’ll learn how to download and install JUnit in Eclipse so that you can use in your...
  • Java
  • October 9, 2022