/*********************************** If文(文字の判定) ************************************/ import java.util.*; public class If04CharCheck { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String keybd; char c; System.out.print("文字を入力して下さい-->"); keybd=sc.nextLine(); c=keybd.charAt(0); if ( c>=0x41 && c<=0x5a ) System.out.print("大文字です\n"); else if ( c>=0x61 && c<=0x7a ) System.out.print("小文字です\n"); else if ( c>=0x30 && c<=0x39 ) System.out.print("数字です\n"); else System.out.print("英数字以外です\n"); System.out.print("\n"); } }