Java program to find whether the given character is an alphabet or not

Read a character from user verify whether it lies between a and z (both small and capital). If it does it is an alphabet.


import java.util.Scanner;
public class AlphabetOrNot {
   public static void main(String args[]){
      System.out.println("Enter a character :: ");
      Scanner sc = new Scanner(;
      char ch =;

      if(((ch >= 'A' && ch <= 'Z')||ch >= 'a' && ch <= 'z') ){
         System.out.println("Given character is an alphabet");
         System.out.println("Given character is not an alphabet");


Enter a character ::
Given character is an alphabet
Samual Sam
Samual Sam

Learning faster. Every day.