java examples
Home Java Examples Resources Java Interview Questions
Brainpower SEO

How to check if a character representing an alphabet?

This example demonstrate how to use Character.isLetter(char c) to check is a character is a valid letter.

package com.javacoderanch.example.lang;

public class CharacterIsLetter
{
    public static void main(String[] args)
    {
        String nama = "Code Java";
        if (Character.isLetter(nama.charAt(5)))
        {
            System.out.println(
              "The fifth character is an alphabet!");
        }
    }
}