Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

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

Test your website on 3000+ browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free