Printing alphabets in Java Programming? Oh common.
It may look silly but you know many of us still don’t know how to write a program to print the alphabets.
Thinking of Java Array or List concepts?? hey wait don’t think too much. The below script will surprise you for sure, because it’s very simple.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
public class atoz { public static void main(String[] args){ //print small letters alphabets for(char i = 'a'; i <='z'; i++){ System.out.print(i); } System.out.println(); //print captial letters alphabets for(char i = 'A'; i <='Z'; i++){ System.out.print(i); } } } |
Yes, like i said it’s damn simple right?. Cool then. Enjoy the day!