这段代码会提示用户输入一个字符,然后判断该字符是否为大写字母,如果是,则将其转换成小写字母并输出;如果不是,则直接输出原始字符。希望这能帮助你解决问题!
/ public static void main(String[] args) { Scanner scanner = new Scanner(System.in);System.out.println("请输入一个字母");char aChar = scanner.nextLine().charAt(0);System.out.println(convertLowerCase(aChar));} / 接收一个字符,如果为小写则转换为大写, 大写则不改变 param aCha...
import java.io.IOException;public class App {public static void main(String[] args) throws IOException {char ch = (char)System.in.read();if (ch >= 'a' && ch <= 'z') {ch -= 32;}System.out.println(ch);}}
import java.util.Scanner;public class Main { public static void main(String[] args) { System.out.println("输入一个字符串:");String str = null;Scanner cin = new Scanner(System.in);while (cin.hasNext()) { str = cin.nextLine();break;} String newStr1 = "";String newStr2...