Write a Java Program to display characters from 'A' to 'Z'.
Here's a simple Java program that displays 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 :
Comments
Post a Comment