java将所有的字符串转换为大写或小写


public class DaXie {
public static void main(String[] args) {
/**将所有的字符串转换成大写或小写字母并打印出来*/
String str = new String("Hello Java World");
System.out.println("原字符串:" + str + "\n");
/*使用toUpperCase()方法实现大写转换*/
String newA = str.toUpperCase();
System.out.println("大写转换:" + newA);
/*使用toLowerCase()方法实现小写转换*/
String newB = str.toLowerCase();
System.out.println("小写转换:" + newB);
  }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM