Pages

Determine character is letter or not

Complete source code below will show you, how to determine character is letter or not in java.

************************************************************
COMPLETE SOURCE CODE FOR : DetermineCharacterIsLetter.java
************************************************************


public class DetermineCharacterIsLetter
{
public static void main(String[]args)
{
//Create a character using char with value(m)
char a='m';

//Determine created character is letter or not
//using method isLetter from class Character.
//isLetter is a static method, so we don't need to create object when
//we want to use it.
if(Character.isLetter(a))
{
//Print (It is a letter) if character is a letter
System.out.println("It is a letter");
}
else
{
//Print (It is not a letter) if character is not a letter
System.out.println("It is not a letter");
}
}
}


************************************************************
JUST COMPILE AND EXECUTE IT
************************************************************
Related Posts Plugin for WordPress, Blogger...