- 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
Java toUpperCase() with examples
The UpperCase() method converts all characters to uppercase letters. This method has two variants. The first variant converts all of the characters in this String to upper case using the rules of the given Locale. This is equivalent to calling toUpperCase(Locale.getDefault()).
Example
Let us now see an example −
import java.io.*; public class Demo { public static void main(String args[]) { String Str = new String("This is it!"); System.out.print("Return Value :" ); System.out.println(Str.toUpperCase() ); } }
Output
Return Value :THIS IS IT!
Example
Let us see another example to implement the toUpperCase() method −
import java.io.*; import java.util.Locale; public class Demo { public static void main(String args[]) { String str = new String("This is it!"); System.out.print("Return Value :" ); System.out.println(str.toUpperCase() ); Locale ENGLISH = Locale.forLanguageTag("en"); String res = str.toUpperCase(ENGLISH); System.out.println(res); } }
Output
Return Value :THIS IS IT! THIS IS IT!
- Related Articles
- Java String toUpperCase() method example.
- Java String toUpperCase() and toLowerCase() methods
- Java Character charCount() with Examples
- Java Stream findAny() with examples
- Java toDegrees() method with Examples
- Java signum() method with Examples
- Java lang.Long.toBinaryString() method with Examples
- Java cbrt() method with Examples
- Java ceil() method with Examples
- Java sqrt() method with Examples
- Java floor() method with Examples
- Java streams counting() method with examples
- Java Signature getAlgorithm() method with Examples
- Java Signature getInstance() method with Examples
- Java Signature getProvider() method with Examples

Advertisements