Java Program to Check if a Character is an Alphabet or not

In this Java tutorial, you’ll learn how to Check if a Character is an Alphabet or not using Java programming language

How to Check if a character is an Alphabet or not? 

In this program, we’ll learn how to Check if a Character is an Alphabet or not through the JAVA program.   

RUN CODE SNIPPET
import java.util.Scanner; 
public class Main 
{ 
     public static void main(String []args) 
     { 
        Scanner sc=new Scanner(System.in); 
        char ch;      
        System.out.println("Enter the character "); 
        ch=sc.next().charAt(0);    
        if((ch>='A' && ch<='Z')||(ch>='a' && ch<='z')) 
        { 
             System.out.print(ch+" is an Alphabet "); 
        } 
        else 
        { 
             System.out.print(ch+" is not an Alphabet "); 
        } 
     }    
}

OUTPUT 

Enter the character Z 
Z is an Alphabet

In the above program, we have used if. Else statement to check if a character is an alphabet or not.