Java Program to Check Whether a Given Character Is Alphabet or Not

Java program to check whether a given character is alphabet or not

import java.util.Scanner;

public class AlphabetOrNot
    public static void main(String args[])
    	//create and initialize object.
        char ch;
        Scanner scan = new Scanner(;
        //Input character
        System.out.print("Enter a Character : ");
        ch =;
        //condition for checking characters.
        if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
            System.out.print(ch + " is an Alphabet");
            System.out.print(ch + " is not an Alphabet");


First run:
Enter a Character : A
A is an Alphabet

Second run:
Enter a Character : @
@ is not an Alphabet
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment