- package com.test;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class SwitchCase {
- public static void main(String[] args) throws IOException{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String line = br.readLine();
- for (int i = 0; i < line.length(); i++) {
- char ch = line.charAt(i);
-
- if(ch>=97&&ch<=122){//小写转大写。
- ch = (char)(ch-32);
- } else if(ch>=65&&ch<=90){//大写转小写。
- ch = (char)(ch+32);
- }
- System.out.print((char)ch);
- }
- br.close();
- }
- }
复制代码 |