Java program to print letters (i.e., a, b, c, ..., z in lower case) on the screen using a loop.
Java program
{
public static void main(String args[])
{
char t;
for (t = 'a'; t <= 'z'; t++) // For upper case use 'A' and 'Z'
System.out.println(t);
}
}
You can modify the program to print them in upper case.
Download Alphabets program class file.
Output of program:
Printing alphabets using a while loop (The code snippet shows only the body of the main method):
while (c <= 'z') {
System.out.println(c);
c++;
}
Using a do while loop:
do {
System.out.println(c);
c++;
} while (c <= 'Z');