Java program to check whether the user input is alphabet or not


Program
import java.util.*; public class CheckAlphabet { public static void main(String[] args) { Scanner s=new Scanner(System.in); char c = s.next().charAt(0); if( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) System.out.println(c + " is an alphabet."); else System.out.println(c + " is not an alphabet."); } }
Input
Output