# Java Programming : Alphabet or not an alphabet

#### Example

```java
Input
A
Output
It is an aplhabet
```

#### **Required to Know**

Use of **Variables**, Use of different operators like **assignment or arithmetic operators**, Use of methods like **System. out.print(),** and use of next().charAt(0), Use of **If-else,** **and** Use of **Data types.**

#### Steps

* Take the character as input from the user.
    
* check if the character falls under these two range: -
    
    * a - z
        
    * A - Z
        
* Now if the character falls under this range, print "it is an alphabet". Otherwise, print "it is not an alphabet".
    

#### Program

```java
import java.util.Scanner;

public class alphabet {

  /**
   * This program checks if a character is an alphabet.
   *
   */
  public static void main(String[] args) {
    // Create a Scanner object to read user input.
    Scanner sc = new Scanner(System.in);

    // Prompt the user to enter a character.
    System.out.print("Enter the character: ");
    char ch = sc.next().charAt(0);

    // Check if the character is an alphabet.
    if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
      // The character is an alphabet.
      System.out.println("It is an alphabet");
    } else {
      // The character is not an alphabet.
      System.out.println("It is not an Alphabet");
    }
  }
}
```
