Java - String toUpperCase() Method
The Java string toUpperCase() method returns the string with all characters of the specified string in uppercase, using the rules of the default locale.
Syntax
public String toUpperCase()
Parameters
No parameter is required.
Return Value
Returns the uppercased version of the specified string.
Example:
In the example below, toUpperCase() method is used to convert all characters of the given string in the uppercase, using default locale.
import java.lang.*; public class MyClass { public static void main(String[] args) { String MyString = "HeLLo John!"; String NewString = MyString.toUpperCase(); System.out.println(NewString); } }
The output of the above code will be:
HELLO JOHN!
❮ Java.lang - String