Print alphabets using java code

Below code will print the English alphabets in upper case using simple "for loop". If you want to print in lower case then simply switch the case of A and Z in the for loop.

public class PrintAlphabets {
    public static void main(String args[]) {
        char ch;

        for (ch = 'A'; ch <= 'Z'; ch++)
            System.out.print(ch + " ");
    }
}


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

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India.
    or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete