To convert
String
to uppercase in Java, call toUpperCase
method.Here's how you do it:
String string = "Hello World!";
String upperCaseString = string.toUpperCase();
System.out.println(upperCaseString); // HELLO WORLD!