The isLowerCase()
method is a method of the Character
class in Java that can be used to determine if a character is a lowercase letter. It returns true
if the character is a lowercase letter, and false
if it is not.
Here is an example of how to use the isLowerCase()
method:
System.out.println(Character.isLowerCase('a')); // Outputs true System.out.println(Character.isLowerCase('A')); // Outputs false System.out.println(Character.isLowerCase('1')); // Outputs false System.out.println(Character.isLowerCase('#')); // Outputs false
In this example, the isLowerCase()
method returns true
for the lowercase letter 'a', and false
for the uppercase letter 'A', the digit '1', and the symbol '#'.
You can also use the isLowerCase()
method to check if a character is lowercase in a string, like this:
String s = "Hello, World!"; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isLowerCase(c)) { System.out.println(c + " is a lowercase letter."); } else { System.out.println(c + " is not a lowercase letter."); } }
In this example, the isLowerCase()
method is used to check each character in the string s
, and prints a message indicating whether the character is a lowercase letter or not.
For more information on the isLowerCase()
method and other methods provided by the Character
class in Java, you can refer to the Java documentation or other online resources.