Continuous Test Orchestration And Execution Platform Online

Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.

Write a Java program to print alphabets using for loop?

In this Java program, we'll print uppercase and lowercase alphabets using for loop.

Here is the Java program that prints uppercase alphabets.

Code:


class PrintUppercase {
  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

Shown below is the Java program that prints the lowercase alphabets.

Code:


class PrintLowercase {
  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

LambdaTest

Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.

Start Free Testing
LambdaTest

Earn resume-worthy Selenium certifications that help you land a top job.

Learn More
LambdaTest

Test your web or mobile apps

Test orchestration and execution cloud of 3000+ browsers and OS

Support

24/7 support

Security

Enterprise grade security

Cloud

Fastest test execution cloud