Java examples on java.lang
- How do I reverse a string?
- How do I add leading zeros to a number?
- How do I split a string?
- How do I get file separator symbol?
- How do I terminate a Java application?
- How do I get operating system temporary directory / folder?
- What is Autoboxing?
- How do I remove trailing white space from a string?
- How do I calculate process elapsed time?
- How do I copy char array to string?
- How do I convert string to char array?
- How do I get package name of a class?
- How do I check if a character representing a number?
- How do I check if a character representing an alphabet?
- How do I get the username of operating system active user?
- How do I remove substring from StringBuilder?
- How do I add a delay in my program?
- How do I get the name of current executed method?
- How do I decode string to integer?
- How do I get super class of an object?
- How do I get Java Home directory?
- How do I convert string to an integer or number?
- How do I use for-each in Java?
- How do I check string for equality?
- How do I get Environment Variables?
- How do I get user home directory name?
- How do I replace characters in string?
- How do I read system property as an integer?
- How do I check if a string contains a specific word?
- How do I create random number?
- How do I reverse a string by word?
- How do I convert other primitive data type into string?
- How do I create a console progress bar?
- How do I get path / classpath separator?
- How do I execute other applications from Java?
- How do I convert decimal to octal?
- How do I get a part or a substring of a string?
- How do I check if a string is a valid number?
- How do I know if a character is lowercase?
- How do I get operating system name and version?
- How do I determine whether a string is a palindrome?
- How do I get the minimum and maximum value of a primitive data types?
- How do I know the length of a string?
- How do I convert varargs to an array?
- How do I know if a character is uppercase?
- How do I get Java Runtime Environment (JRE) version?
- How do I check a string ends with a specified word?
- How do I convert decimal to binary?
- How do I convert decimal to hexadecimal?
- How do I check a string starts with a specified word?
- How do I check if a thread is alive?
- How do I know the memory size in virtual machine?
- How do I copy some items of an array into another array?
- How do I create a thread by implementing Runnable interface?
- How do I know a class of an object?
- How do I use join method to wait for threads to finish?
- How do I set the priority of a thread?
- Can I create a boolean variable from string?
- How do I remove leading white space from a string?
- How do I set and get the name of a thread?
- How do I get interfaces implemented by a class?
- How do I count the number of occurrences of a char in a String?
- How do I insert a string in the StringBuilder?
- How do I convert primitive boolean type into Boolean object?
- How do I create a deamon thread?
- How do I create a thread by extending Thread class?
- How do I create a multithread program?
- How do I create a method that accept varargs in Java?
- How do I clear system property?
- How do I validate email address using regular expression?
- How do I pause the current thread?
- How do I start a thread execution?
- How do I get the currently executing thread?
- How do I calculate process execution time in higher resolution?
- How do I remove leading and trailing white space from string?
- How do I use the sleep method of the Thread class?
- How do I check if a thread is a daemon thread?
- How do I get the name of a class?
- How do I know if a class object is an interface or a class?
- How do I create a thread synchronized block?
- How do I check whether a thread group has been destroyed?
- How do I use multi-catch statement?
- How do I count active thread in a thread group?
- How do I create array of unique values from another array?
- How do I remove some characters from a StringBuffer?
- How do I destroy a thread group?
- How do I execute external command and obtain the result?
- How do I get the path from where a class is loaded?
- How do I get the state of a thread?
- How do I get thread group of a thread?
- How do I get number of active thread group?
- How do I get number of active thread in current thread?
- How do I get char value of a string at a specified position?
- How do I append and replace content of a StringBuffer?
- How do I insert a string to a StringBuffer?
- How do I split a string with multiple spaces?
- How to split a string by a number of characters?
How do I know if a character is lowercase?
In this example you'll learn another example on using the Character class. The Character.isLowerCase() method can be use to determine if a letter is a lowercase letter. This method takes a char as argument and return a boolean value. If it returns true it means the character is in lowercase form. And if it returns false it means the character is not in lowercase form.
Besides using the isLowerCase() method you can also compare the character type with the constant value of Character.LOWERCASE_LETTER. To get the character type you can use the Character.getType() method. You can see the example on the following code snippet.
package org.kodejava.example.lang;
public class CharacterIsLowerCase {
public static void main(String[] args) {
char a = 'a';
//
// Checks to see if a letter is a lowercase letter.
//
if (Character.isLowerCase(a)) {
System.out.println(a + " is a lowercase character.");
}
//
// Checks to see if a letter is a lowercase letter
// by comparing the character type against
// Character.LOWERCASE_LETTER constant value.
//
int charType = Character.getType(a);
if (charType == Character.LOWERCASE_LETTER) {
System.out.println(a + " is a lowercase character.");
}
}
}
This example give you the following output:
a is a lowercase character. a is a lowercase character.