Lanqiao Cup case conversion

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class 大小写转换 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		char c[]  = br.readLine().toCharArray();
		for (int i = 0; i < c.length; i++) {
			if(c[i]>=65 && c[i]<=90){
				c[i]+=32;
			}else{
				c[i]-=32;
			}
		}
		System.out.println(new String(c));
		
	}


}

System.in is an instantiated object of the print stream. The role of the InputStreamReader class is to convert external byte data into character data and enter it into the program memory.

The purpose of the BufferedReader class is to read the data information in the buffer

Published 44 original articles · Likes2 · Visits 540

Guess you like

Origin blog.csdn.net/qq_43699776/article/details/104857245