Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Java » Programs » Check if Character is alphabet or not

Java program to check if Character is alphabet or not

public class Main {

	public static void main(String[] args) {
		System.out.println("## Java program to check if character is alphabet or not ##");
		
		char ch='0';
		
		if((ch >= 'a' && ch <='z') || (ch >= 'A' && ch <='Z')) {
			System.out.println(ch + " is an alphabet");
		}	
		else {
			System.out.println(ch + " is not an alphabet");
		}
	}

}