请问什么地方错了?
来源:3-9 编程练习
慕盖茨1205792
2019-05-27 22:02:53
6回答
慕粉2137545909
2019-06-01
你的break后面跟的是中文分号
gogoJava
2019-06-10
目测没有问题
weixin_慕移动6211617
2019-05-28
public class CharDemo {
public static void main(String[] args) {
//定义一个字符变量并初始化
char ch='a';
//使用switch结构判断是否为元音字母,并输出对应的信息
switch(ch){
case 'a':System.out.println("元音字母"+ch);break;
case 'e':System.out.println("元音字母"+ch);break;
case 'i':System.out.println("元音字母"+ch);break;
case 'o':System.out.println("元音字母"+ch);break;
case 'u':System.out.println("元音字母"+ch);break;
default:System.out.println("不是元音字母");
}
}
}
好帮手慕小班
2019-05-28
同学你好,在本小节中在线编辑器是支持String的哦!例如:
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
好帮手慕小班
2019-05-28
同学你好,报错原因可能是break后的分号写错哦!,例如:
这两个分号不一样哦!
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~
Akebono
2019-05-27
public class CharDemo {
public static void main(String[] args) {
//定义一个字符变量并初始化
char ch='a';
//使用switch结构判断是否为元音字母,并输出对应的信息
switch(ch){
case 'a':System.out.println("元音字母"+ch);break;
case 'e':System.out.println("元音字母"+ch);break;
case 'i':System.out.println("元音字母"+ch);break;
case 'o':System.out.println("元音字母"+ch);break;
case 'u':System.out.println("元音字母"+ch);break;
default:System.out.println("不是元音字母");
}
}
}
相似问题