Problem: switch is used to convert the lowercase char type to uppercase. Only the output "other" of A, B, C, D, E. Is converted ".
Import Java. util. imports; import Java. io. ioexception;/* receives a character from the console and prints it out. // although this method obtains the input character from the keyboard. in. read () can only be obtained for one character. At the same time, the retrieved variable type can only be char. When we enter a number and want to obtain an integer variable, we have to modify the variable type, which makes it quite troublesome. */Class test5 {public static void main (string [] ARGs) throws ioexception {// S = new evaluate (system. in); // string c = S. next (); char c = (char) system. in. read (); Switch (c) {Case 'A': system. out. println ("A"); break; Case 'B': system. out. println ("B"); break; Case 'C': system. out. println ("C"); break; Case 'D': system. out. println ("D"); break; Case 'E': system. out. println ("e"); break; default: system. out. println ("other"); break ;}}}
This article is from the "First day of course" blog, please be sure to keep this source http://5453607.blog.51cto.com/5443607/1529887