Pages

Determine character is uppercase

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

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


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

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


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