Java中大小寫轉換的方法有以下幾種:
String str = "HelloWorld";
String upperCaseStr = str.toUpperCase();
System.out.println(upperCaseStr); // 輸出:HELLOWORLD
String str = "HelloWorld";
String lowerCaseStr = str.toLowerCase();
System.out.println(lowerCaseStr); // 輸出:helloworld
char c = 'a';
char upperCaseChar = Character.toUpperCase(c);
System.out.println(upperCaseChar); // 輸出:A
char c = 'A';
char lowerCaseChar = Character.toLowerCase(c);
System.out.println(lowerCaseChar); // 輸出:a