In this section, we will learn what the Character isUpperCase() method is and how to use it in Java.
What is Java Character isUpperCase() Method?
The `isUpperCase()` method is used to check whether or not the target character that we set as the argument of the method is an uppercase letter.
Java isUpperCase() Method Syntax:
static boolean isUpperCase(char ch)
isUpperCase() Method Parameters:
The method takes one argument and that is the character we want to check and see if it’s an uppercase letter or not.
isUpperCase() Method Return Value:
The return value of this method is a boolean.
If the character was uppercase, then the result will be `true` otherwise is `false`.
Example: using Character isUpperCase() method
public class Simple { public static void main(String args[]) { String s = "You Never Know What Will Happen Tomorrow"; for (char c: s.toCharArray()){ System.out.print(Character.isUpperCase(c)+", "); } } }
Output:
true, false, false, false, true, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, false, false, false,