Introduction
One of the most widely used programming languages on the planet is Java. Learning Java strengthens fundamental computer science concepts and opens the door to various career opportunities.
Several methods provided in Java to perform operations in Strings are called String functions. In this article, we will learn how to use the string toUpperCase() function.

String toUpperCase() Function
Java String toUpperCase() is a built-in function method that converts all characters in the string to upper case characters.
Syntax
The syntax of string toUpperCase() method is given below:
string.toUpperCase()
The string is a String class object in this case.
Parameter
The toUpperCase() method doesn't take any parameters.
Return Value
It returns a string with all lower case letters converted to uppercase.
Example
Input: Coding Ninjas
Output: CODING NINJAS
Implementation
Java Code
import java.util.*;
import java.io.*;
import java.lang.*;
class CodingNinjas
{
public static void main(String[] args) {
String str1 = "Coding Ninjas";
String str2 = "Java123";
String output = str1.toUpperCase();
// convert to upper case letters
System.out.println("The result of string toUpperCase() method: ");
System.out.println(output);
System.out.println(str2.toUpperCase());
}
}
Output
The result of string toUpperCase() method:
CODING NINJAS
JAVA123
Must Read: Java System Out Println