Showing posts with label digit. Show all posts
Showing posts with label digit. Show all posts

Determine character is letter or digit

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

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


public class DetermineCharacterIsLetterOrDigit
{
public static void main(String[]args)
{
//Create a character using char with value(3)
//You can try change it's value to letter(k)
char a='3';

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


*****************************************************************
JUST COMPILE AND EXECUTE IT
*****************************************************************

Determine character is digit or not

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

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


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

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


*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************

RELAXING NATURE VIDEO