Java String to Uppercase: Quick Guide

You can use the toUpperCase() method of the String class in Java to convert a string to uppercase. Here is an example code:

public class Main {
    public static void main(String[] args) {
        String str = "hello world";
        String upperCaseStr = str.toUpperCase();
        
        System.out.println(upperCaseStr); // 输出: HELLO WORLD
    }
}
bannerAds