Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java toUpperCase() Method

Java toUpperCase() Method

Java String ClassJava String class


The toUpperCase() method converts the lowercase characters of the string to uppercase.

Syntax


public String toUpperCase()

或

public String toUpperCase(Locale locale)

Parameters

Return Value

The string after the characters are converted to uppercase.

Example


public class Test {
    public static void main(String args[]) {
        String Str = new String("www.runoob.com");

        System.out.print("返回值 :" );
        System.out.println( Str.toUpperCase() );
    }
}

The execution result of the above program is:

返回值 :WWW.RUNOOB.COM

Java String ClassJava String class