java.lang.String.toUpperCase()


 

java.lang.String.toUpperCase()

toUpperCase() method of string class coverts all the string character into uppercase letters.

toUpperCase() method of string class coverts all the string character into uppercase letters.

As the method name suggest "toUpperCase()" it is used to convert all the characters given into the string to upper case. This method is useful when you need the generated output into upper case for example while showing the user information..you can conver the first name and last name format into upper case using toUpperCase() string class method.

a simple String.toUpperCase() java example:

public class Uppercase

{

public static void main(String[] args)

{

String str = "convert to upper case java example.";

// to convert the string into Upper Case.

String upper = str.toUpperCase();

// Display the two strings for comparison.

System.out.println("Orignal Value = " + str);

System.out.println("Changed to UpperCase = " + upper );

}

}

the output is:

Orignal Value = convert to upper case java example.

Changed to UpperCase = CONVERT TO UPPER CASE JAVA EXAMPLE. 

Example Code

toUpperCase() Method In Java

Ads