通过String类的toUpperCase()方法和toLowerCase()方法实现字符串大小写的转换。
public class UpperCaseAndLowerCase {
public static void main(String[] args) {
String str="Excuse me,I don't think we've met.My name's Simon.";
String upstr=str.toUpperCase();
String lower=str.toLowerCase();
System.out.println("原字符串为:");
System.out.println("\t"+str);
System.out.println("转换为大写为:");
System.out.println("\t"+upstr);
System.out.println("转换为小写为:");
System.out.println("\t"+lower);
}
}