Java program to check whether a character is alphabet or not

Configurare noua (How To)

Situatie

In this program, you’ll learn to check whether a given character is an alphabet or not.

Solutie

Pasi de urmat

public class Alphabet {

public static void main(String[] args) {

char c = ‘*’;

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.”);
}
}

Output:

* is not an alphabet.

Tip solutie

Permanent

Voteaza

(13 din 33 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?