- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How can we print all the capital letters of a given string in Java?
The Character class is a subclass of Object class and it wraps a value of the primitive type char in an object. An object of type Character class contains a single field whose type is char.
We can print all the uppercase letters by iterating the characters of a string in a loop and check individual characters are uppercase letters or not using isUpperCase() method and it is a static method of a Character class.
Syntax
public static boolean isUpperCase(char ch)
Example
public class PrintUpperCaseLetterStringTest { public static void main(String[] args) { String str = "Welcome To Tutorials Point India"; for(int i = 0; i < str.length(); i++) { if(Character.isUpperCase(str.charAt(i))) { System.out.println(str.charAt(i)); } } } }
Output
W T T P I
- Related Articles
- How to move all capital letters to the beginning of the string in JavaScript?
- Print all permutations of a given string
- How can we add an underscore before each capital letter inside a java String?
- Print all permutations of a string in Java
- How can we remove all the prefixes or suffixes from a given string in MySQL?
- How to find If a given String contains only letters in Java?
- Program to print all substrings of a given string in C++
- Python Program to print all permutations of a given string
- C Program to print all permutations of a given string
- How to print all the characters of a string using regular expression in Java?
- Print all permutation of a string using ArrayList in Java
- Print all distinct permutations of a given string with duplicates in C++
- Program to find list of all possible combinations of letters of a given string s in Python
- Move string capital letters to front maintaining the relative order - JavaScript
- Java Program to Print all unique words of a String

Advertisements