/*7、编写程序,从键盘接收一个字符串,对字符串中的字母进行大小写互转(大写字母转成小写,小写字母转成大写)。*/
import java.util.Scanner;
public class Test7 {
public static void main(String[] args){
Scanner in=new Scanner(System.in);
System.out.println("请输入字符串:");
String str=in.next();
char[] ch1=str.toCharArray();
char[] ch2=new char[ch1.length];
for(int i=0;i<ch1.length;i++){
ch2[i]=ch1[i];
if(ch2[i] >= 97 && ch2[i] <= 122)
{
ch2[i]=(char)((int)ch2[i]-32);
System.out.print(ch2[i]);
}
else if(ch2[i] >= 65 && ch2[i] <= 90){
ch2[i]=(char)((int)ch2[i]+32);
System.out.print(ch2[i]);
}
else{
System.out.print("输入不符合要求");
}
}
}
}