New Tutorials:   NUMPY    TKINTER    KOTLIN    JAVASCRIPT    SASS/SCSS    PL/SQL    Matplotlib    C++ Programs

Java Character isUpperCase(int codePoint) Method

Java isUpperCase(int codePoint) method is a part of Character class. This method is used to check whether the specified Unicode codepoint character is an uppercase character or not.

This method also supports supplementary characters. A character is uppercase if its general category type, provided by Character.getType(ch), is UPPERCASE_LETTER. or it has contributory property Other_Uppercase as defined by the Unicode Standard.

Syntax:

public static boolean isUpperCase(int codePoint)

Parameters:

The parameter passed is the Unicode codepoint character to be checked whether it is an uppercase character.

Returns:

Returns the boolean value true if the specified codepoint character is an uppercase character else return false

Example 1:

Here, the characters are checked whether they are uppercase characters or not.

public class StudyTonight
{  
	public static void main(String[] args)
	{  
		int cp1 = 73;  
		int cp2 = 60;  
		int cp3 = 119;  
		int cp4 = 80;   
		int cp5 = 1232;  

		boolean b1 = Character.isUpperCase(cp1);  
		boolean b2 = Character.isUpperCase(cp2);  
		boolean b3 = Character.isUpperCase(cp3);  
		boolean b4 = Character.isUpperCase(cp4);  
		boolean b5 = Character.isUpperCase(cp5);  

		System.out.println((char)cp1 +" is uppercase??::  "+b1);  
		System.out.println((char)cp2 +" is uppercase??::  "+b2);  
		System.out.println((char)cp3 +" is uppercase??::  "+b3);  
		System.out.println((char)cp4 +" is uppercase??::  "+b4);  
		System.out.println((char)cp5 +" is uppercase??::  "+b5);  
	}  
} 


I is uppercase??:: true
< is uppercase??:: false
w is uppercase??:: false
P is uppercase??:: true
? is uppercase??:: true

Example 2:

Here is a user-defined example where anyone using this code can put a value of his choice and get the equivalent output.

import java.util.Scanner; 
public class StudyTonight
{  
	public static void main(String[] args)
	{  
		try
		{
			System.out.print("Enter the Unicode character: ");  
			Scanner sc = new Scanner(System.in);        
			int cp = sc.nextInt(); 
			boolean b = Character.isUpperCase(cp);
			System.out.println((char)cp + " is UpperCase??: "+b);
		}
		catch(Exception e)
		{
			System.out.println("Invalid Input!!");
		}
	}
}


Enter the Unicode character: 77
M is UpperCase??: true
****************************************
Enter the Unicode character: 96
` is UpperCase??: false

Live Example:

Here, you can test the live code example. You can execute the example for different values, even can edit and write your examples to test the Java code.