Java toUpperCase() Method

In this section, you will learn how to use toUpperCase() method of the String class.

Java toUpperCase() Method

In this section, you will learn how to use toUpperCase() method of the String class.

Java toUpperCase() Method In Java

Java toUpperCase() Method In Java

In this section you will learn about how to use toUpperCase() in Java. From the name of the method you can also know what this function does?, this function is of String class convert the string into upper case

Syntax :

public String toUpperCase()

Return Value :

It return the string in upper case.

Here str is String object, which contain the string to convert in uppercase. toUpperCase() method is of string class.

Description of code : Here is the example using toUpperCase() method  to convert to upper case in java. First we declare a class named "Touppercase.java". In that class we have declared one String object and initialize it with the string "rose india" and passing that string to println() method. Then uppercase() method will return the string in Upper case as "ROSE INDIA".

public class Touppercase {
	public static void main(String args[])
   {
		String str="rose india";
		System.out.println(str.toUpperCase());
	}
}

Output from the program

Download Source Code