• How can we count upper case letter in String  java ?
  • How to find uppercase letters in String  java?
  • How to find capital letters in string in java?
  • How u discover the capital letter given sentence?
  • Yes We can find uppercase or capital letters in a String using isUpperCase() method of Character class in java
  • In order to find number of uppercase letters in a string of all capital letters in a string we need to iterate all characters of a string in a loop and check individual characters are uppercase letters or not using Character class provided isUpperCase() method.
  • To find the uppercase letters in a string in Java, you can use the isUpperCase() method of the Character class.

Program #1: Java example program to find all capital letters / Uppercase letters in a String

  1. package findUppercaseletters.String;
  2. public class FinfUppercaseLetters {
  4.     /**
  5.      * @website: www.instanceofjava.com
  6.      */
  8.  public static void main(String[] args) {
  11.   String str= "How to Print Uppercase Letters in Java";
  13.     for (int i = 0; i < str.length(); i++) {
  15.             if(Character.isUpperCase(str.charAt(i))){    
  16.             System.out.println(str.charAt(i));
  17.             }
  19.  }
  21. }
  23. }


  1. H
  2. P
  3. U
  4. L
  5. J
  • Above code will print all the uppercase letters in the string.
  • Alternatively, you can also use the toUpperCase() method of the Character class to convert all the characters in the string to uppercase and then use the equals() method to compare them to the original character.
Program #2: Java example program to count number of upperCase letters in a String

how to find uppercase letters in a string in java

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
Newer Post
Older Post

No comments

Leave a Reply

Select Menu