Java字符串大小寫轉換的方法有以下幾種:
String str = "hello";
String upperCaseStr = str.toUpperCase();
System.out.println(upperCaseStr); // 輸出: HELLO
String str = "HELLO";
String lowerCaseStr = str.toLowerCase();
System.out.println(lowerCaseStr); // 輸出: hello
String str = "hello";
char ch = str.charAt(0);
char upperCaseCh = Character.toUpperCase(ch);
System.out.println(upperCaseCh); // 輸出: H
String str = "HELLO";
char ch = str.charAt(0);
char lowerCaseCh = Character.toLowerCase(ch);
System.out.println(lowerCaseCh); // 輸出: h