- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Example
import java.util.Scanner; public class AlphabetOrNot { public static void main(String args[]){ System.out.println("Enter a character :: "); Scanner sc = new Scanner(System.in); char ch = sc.next().charAt(0); if(((ch >= 'A' && ch <= 'Z')||ch >= 'a' && ch <= 'z') ){ System.out.println("Given character is an alphabet"); }else{ System.out.println("Given character is not an alphabet"); } } }
Output
Enter a character :: d Given character is an alphabet
- Related Articles
- Java Program to Check Whether a Character is Alphabet or Not
- C++ Program to Check Whether a Character is Alphabet or Not
- Haskell Program to Check Whether a Character is Alphabet or Not
- Java program to find whether given character is vowel or consonant
- Java Program to Check Whether an Alphabet is Vowel or Consonant
- How to check whether a character is in the Alphabet or not in Golang?
- Java program to find whether given character is vowel or consonant using switch case
- Haskell Program to Check Whether an Alphabet is Vowel or Consonant
- Java program to check whether a given string is Heterogram or not
- Java program to find whether the given string is empty or null
- Java program to find whether given number is even or odd
- Check whether a character is Lowercase or not in Java
- Check whether a character is Uppercase or not in Java
- C++ program to check whether given string is bad or not
- C++ Program to check whether given password is strong or not

Advertisements