Home Tutorial Java StringExamples java.lang.String.toUpperCase()

 
 

Share on Google+Share on Google+
java.lang.String.toUpperCase()
Posted on: March 22, 2005 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for java.lang.String.toUpperCase():


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 22, 2005

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com