Signup/Sign In

Java Character isLowerCase(char ch) Method

Java isLowerCase(char ch) method is a part of Character class. This method is used to check whether the specified character is a lowercase letter or not.

This method does not handle supplementary characters.

Syntax:

public static boolean isLowerCase(char ch)  

Parameters:

The parameter passed is the character to be checked whether it is a lowercase character or not.

Returns:

Returns the boolean value true if the specified character is a lowercase character else return false.

Example 1:

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

public class StudyTonight
{  
	public static void main(String[] args)
	{  
		char ch1 = 'q';  
		char ch2 = 'D';  
		char ch3 = '8';  
		char ch4  = 'w';   
		char ch5  = '%';  

		boolean b1 = Character.isLowerCase(ch1);  
		boolean b2 = Character.isLowerCase(ch2);  
		boolean b3 = Character.isLowerCase(ch3);  
		boolean b4 = Character.isLowerCase(ch4);  
		boolean b5 = Character.isLowerCase(ch5);  

		System.out.println(ch1 +" is a lowercase character??:  "+b1);  
		System.out.println(ch2 +" is a lowercase character??:  "+b2);  
		System.out.println(ch3 +" is a lowercase character??:  "+b3);  
		System.out.println(ch4 +" is a lowercase character?? : "+b4);  
		System.out.println(ch5 +" is a lowercase character??:  "+b5);  
	}  
} 


q is a lowercase character??: true
D is a lowercase character??: false
8 is a lowercase character??: false
w is a lowercase character?? : true
% is a lowercase character??: false

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 character: ");  
			Scanner sc = new Scanner(System.in);         
			char ch = sc.next().charAt(0);  
			boolean b = Character.isLowerCase(ch);
			System.out.println(ch + " is a lowercase?: "+b);
		}
		catch(Exception e)
		{
			System.out.println("Invalid Input!!");
		}
	}  
}


Enter the character: u
u is a lowercase?: true
***************************
Enter the character: R
R is a lowercase?: 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.



About the author:
A Computer Science and Engineering Graduate(2016-2020) from JSSATE Noida. JAVA is Love. Sincerely Followed Sachin Tendulkar as a child, M S Dhoni as a teenager, and Virat Kohli as an adult.