import java.util.Scanner; public class judge { public static void main(String[] args) { System.out.println("请输入字母"); Scanner sc=new Scanner(System.in); String a=sc.next(); char b=a.charAt(0);//此使用字符截取,将a中第一个元素赋值数组 if(b=='a'||b=='o'||b=='e'||b=='i'||b=='u'||b=='A'||b=='O'||b=='E'||b=='I'||b=='U') { System.out.print("为元音"); } else { System.out.print("为辅音"); } } }