Example of String toUpperCase() Method in Java
Below is the implementation of the String toUpperCase() Method in Java:
java
// Java Program to Demonstrate Working of // toUpperCase() method // Main class class GFG { // Main driver method public static void main(String args[]) { // Custom input string String str = "Welcome! to w3wiki" ; // Converting above input string to // uppercase letters using UpperCase() method String strup = str.toUpperCase(); // Print the uppercased string System.out.println(strup); } } |
Output
WELCOME! TO w3wiki
Note: Lowercase is done using the rules of the given Locale.
Java String toUpperCase() Method
The Java String toUpperCase() method of the String class has converted all characters of the string into an uppercase letter. There is two variant of toUpperCase() method. The key thing that is to be taken into consideration is toUpperCase() method worked the same as to UpperCase(Locale.getDefault()) method as internally default locale is used. In this article, we will learn about String toUpperCase() Method in Java.
Contact Us