本帖最后由 toShareBeauty 于 2013-7-28 13:12 编辑
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String s = new String("ajld243DKJkjd85UYOjYhggI");
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if ('a' <= c && c <= 'z') {
- c = Character.toUpperCase(c);
- }else if ('A' <= c && c <= 'Z') {
- c = Character.toLowerCase(c);
- }
- buffer.append(c);
- }
-
- System.out.println(buffer.toString());
- }
复制代码 如果你是 入学考试,最好自己做哈,这么简单的如果不会,估计后面跟不上哦。 |