题解 | #判断是元音还是辅音#
判断是元音还是辅音
http://www.nowcoder.com/practice/7eb4df4d52c44d309081509cf52ecbc4
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] strs = {"A","a","E","e","I", "i","O","o","U","u"};
while(scanner.hasNext()) {
String str = scanner.next();
int i;
for(i = 0; i < strs.length; i++) {
if(strs[i].equals(str)) {
System.out.println("Vowel");
break;
}
}
if(i >= 10) {
System.out.println("Consonant");
}
}
}
}
Java基础练习题 文章被收录于专栏
都是一些基础的语法题目,每天可以刷几道。