- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Check whether a character is Lowercase or not in Java
To check whether a character is in Lowercase or not in Java, use the Character.isLowerCase() method.
We have a character to be checked.
char val = 'q';
Now let us use the Character.isLowerCase() method.
if (Character.isLowerCase(val)) { System.out.println("Character is in Lowercase!"); }else { System.out.println("Character is in Uppercase!"); }
Let us see the complete example now to check for Lowercase in Java.
Example
public class Demo { public static void main(String []args) { System.out.println("Checking for Lowercase character..."); char val = 'q'; System.out.println("Character: "+val); if (Character.isLowerCase(val)) { System.out.println("Character is in Lowercase!"); } else { System.out.println("Character is in Uppercase!"); } } }
Output
Checking for Lowercase character... Character: q Character is in Lowercase!
Advertisements