There are two forms of String.toUpperCase() methods.
- toUpperCase() - Converts all of the characters in this String to upper case using the rules of the default locale.
- String toUpperCase(Locale locale) - Converts all of the characters in this String to upper case using the rules of the given Locale.
This is a complete example to demonstrate the usage of both toUpperCase() methods.
public class ToUpperCaseExample {
public static void main(String[] args) {
String str = "javaguides";
String subStr = str.toUpperCase();
System.out.println(subStr);
subStr = str.toUpperCase(Locale.ENGLISH);
System.out.println(subStr);
}
}
Output:
JAVAGUIDES JAVAGUIDES
Reference
Free Spring Boot Tutorial - 5 Hours Full Course
Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course