Write a ‘java’ program to display characters from ‘A’ to ‘Z’. | EasyCoding45

Write a Java Program to display characters from 'A' to 'Z'.



public class DisplayAlphabet {
    public static void main(String[] args) {
        // Loop to display characters from 'A' to 'Z'
        for (char ch = 'A'; ch <= 'Z'; ch++) {
            System.out.print(ch + " ");
        }
    }
}

Note: This program uses a for loop to iterate through the characters from 'A' to 'Z' and prints each character on the same line. You can copy and paste this code into a Java file (e.g., DisplayAlphabet.java) and then compile and run it using a Java compiler.

Output :

https://easycoding45.blogspot.com/2023/11/write-java-program-to-display.html


Comments