import java.util.Scanner; public class Test { public static void main(String[] args) { System.out.print(请输入一个字母:); Scanner scan = new Scanner(System.in); char c = scan.nextLine().charAt(0); char ch = Character.isLowerCase(c)? Character.toUpperCase(c):Character.toLowerCase(c); System.out.println(你输入的是:+c+转换过后为:+ch); } }