Java Program to check whether the entered value is ASCII 7-bit alphabetic lowercase


To check whether the entered value is ASCII 7-bit alphabetic lowercase, check the character from ‘a’ to ‘z’.

Here, we have a character.

char one = 'm';

Now, we have checked a condition with if-else to check for lowercase character from ‘a’ to ‘z’

if (one >= 'a' && one <= 'z') {
   System.out.println("Given character is in lowercase!");
} else {
   System.out.println("Given character is not in lowercase!");
}

Example

 Live Demo

public class Demo {
   public static void main(String []args) {
      char one = 'm';
      System.out.println("Character: "+one);
      if (one >= 'a' && one <= 'z') {
         System.out.println("Given character is in lowercase!");
      } else {
         System.out.println("Given character is not in lowercase!");
      }
   }
}

Output

Character: m
Given character is in lowercase!

Let us see another example.

Example

 Live Demo

public class Demo {
   public static void main(String []args) {
      char one = 'N';
      System.out.println("Character: "+one);
      if (one >= 'a' && one <= 'z') {
         System.out.println("Given character is in lowercase!");
      } else {
         System.out.println("Given character is not in lowercase!");
      }
   }
}

Output

Character: N
Given character is not in lowercase!

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 26-Jun-2020

97 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements