请问什么地方错了?

来源:3-9 编程练习

慕盖茨1205792

2019-05-27 22:02:53

http://img.mukewang.com/climg/5cebee090001e3e609010447.jpg

写回答

6回答

慕粉2137545909

2019-06-01

你的break后面跟的是中文分号

2

gogoJava

2019-06-10

目测没有问题

0

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("不是元音字母");

}

}

}


0

好帮手慕小班

2019-05-28

同学你好,在本小节中在线编辑器是支持String的哦!例如:

http://img.mukewang.com/climg/5cec9db40001c2aa11860511.jpg

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

0

好帮手慕小班

2019-05-28

同学你好,报错原因可能是break后的分号写错哦!,例如:

http://img.mukewang.com/climg/5cec9d0d000136ab04780082.jpg

这两个分号不一样哦!

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

0

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("不是元音字母");

}

}

}


0
hkebono
h 课件的题目测试是老版本不支持switch后跟字符串
h019-05-27
共1条回复

0 学习 · 11489 问题

查看课程