早教吧作业答案频道 -->其他-->
求错。总是无法编译出.class文件publicclassweather2{publicstaticvoidmain(String[]args){intx=8;switch(x){case3:case4:case5:System.out.println(x+"ThisisSpring.");break;case6:case
题目详情
求错。总是无法编译出.class 文件
public class weather2
{
public static void main(String[]args)
{
int x = 8;
switch (x)
{
case 3:
case 4:
case 5:
System.out.println(x+"This is Spring.");
break;
case 6:
case 7:
case 8:
System.out.println(x+"This is Summer.");
break;
case 9:
case 10:
case 11:
System.out.println(x+"This is Autumn.");
break;
case 12:
case 1:
case 2:
System.out.println(x+"This is Winner.");
default:
System.out.println(x+"None.");
break;
}
}
}
public class weather2
{
public static void main(String[]args)
{
int x = 8;
switch (x)
{
case 3:
case 4:
case 5:
System.out.println(x+"This is Spring.");
break;
case 6:
case 7:
case 8:
System.out.println(x+"This is Summer.");
break;
case 9:
case 10:
case 11:
System.out.println(x+"This is Autumn.");
break;
case 12:
case 1:
case 2:
System.out.println(x+"This is Winner.");
default:
System.out.println(x+"None.");
break;
}
}
}
▼优质解答
答案和解析
自己对比吧-------------------------把你的复制的确不行!!!我重写了一遍但是没有发现错误!代码一样哦
public class weather2 {
public static void main(String[] args) {
int x = 8;
switch (x) // 用switch实现多分支语句
{
case 3:
case 4:
case 5:
System.out.println(x + "This is Spring.");
break;
case 6:
case 7:
case 8:
System.out.println(x + "This is Summer.");
break;
case 9:
case 10:
case 11:
System.out.println(x + "This is Autumn.");
break;
case 12:
case 1:
case 2:
System.out.println(x + "This is Winner.");
default:
System.out.println(x + "None.");
break;
}
}
}
public class weather2 {
public static void main(String[] args) {
int x = 8;
switch (x) // 用switch实现多分支语句
{
case 3:
case 4:
case 5:
System.out.println(x + "This is Spring.");
break;
case 6:
case 7:
case 8:
System.out.println(x + "This is Summer.");
break;
case 9:
case 10:
case 11:
System.out.println(x + "This is Autumn.");
break;
case 12:
case 1:
case 2:
System.out.println(x + "This is Winner.");
default:
System.out.println(x + "None.");
break;
}
}
}
看了 求错。总是无法编译出.cla...的网友还看了以下:
选出与所给单词括号部分的读音相同的一项.1:cr(y).A:tr(y);B:cit(y);C:(y 2020-05-13 …
若向量a,b,c满足:Ia I=3,I b I=1,a*b=0且b-a=2c,则Ia+c I=—— 2020-05-13 …
1.设有变量定义inti,j;与表达式i==0&&j==0等价的表达式是:()(A)i==j(B) 2020-05-14 …
MATLAB设计Jacobi迭代法运行错误,设计函数:function [x,k]=jacobi_ 2020-05-16 …
从A、B、C、D中选择一个最佳答案.A:I wonder if I could use your 2020-05-16 …
My father got very angry______ A.with that I had 2020-05-16 …
A.A—B—C—H—I—K;A—B—C—H—J—K;A—B—C—D—E—F—GB.A—B—C—H—I 2020-05-26 …
选择元音字母在单词中发音不同的一项.1;A:h(a)nd;B:f(a)ce;C:(a)pple.2 2020-06-17 …
补全对话,求完成A:HelloB:Oh,goodmorning.MayIAnn,please?A: 2020-07-10 …
(斐波那契数列)谁能解释一下这个程序中的“c[i]:=c[i]+a[i]+b[i];varn,i, 2020-07-23 …