Java.lang.String.toUpperCase() Method
Advertisements
Description
The java.lang.String.toUpperCase() method converts all of the characters in this String to upper case using the rules of the default locale.
Declaration
Following is the declaration for java.lang.String.toUpperCase() method
public String toUpperCase()
Parameters
NA
Return Value
This method returns the String, converted to uppercase.
Exception
NA
Example
The following example shows the usage of java.lang.String.toUpperCase() method.
package com.tutorialspoint;
import java.lang.*;
public class StringDemo {
public static void main(String[] args) {
// converts all lower case letters in to upper case letters
String str1 = "This is TutorialsPoint";
System.out.println("string value = " + str1.toUpperCase());
str1 = "www.tutorialspoint.com";
System.out.println("string value = " + str1.toUpperCase());
}
}
Let us compile and run the above program, this will produce the following result:
string value = THIS IS TUTORIALSPOINT string value = WWW.TUTORIALSPOINT.COM