class Season
{
public static void main(String[] args)
{
int x = 4;
if(x==3 || x==4 || x==5)
System.out.println(x+"春季");
else if(x==6 || x==7 || x==8)
System.out.println(x+"夏季");
else if(x==9 || x==10 || x==11);
System.out.println(x+"秋季");
else if(x==12 || x==1 || x==2);
System.out.println(x+"冬季");
else
System.out.println(x+"月份不存在");
}
}
Seasun.java:16: 错误: 有 'if', 但是没有 'else'
else if(x==12 || x==1 || x==2);
^
Seasun.java:20: 错误: 有 'if', 但是没有 'else'
else
^
2 个错误
{
public static void main(String[] args)
{
int x = 4;
if(x==3 || x==4 || x==5)
System.out.println(x+"春季");
else if(x==6 || x==7 || x==8)
System.out.println(x+"夏季");
else if(x==9 || x==10 || x==11);
System.out.println(x+"秋季");
else if(x==12 || x==1 || x==2);
System.out.println(x+"冬季");
else
System.out.println(x+"月份不存在");
}
}
Seasun.java:16: 错误: 有 'if', 但是没有 'else'
else if(x==12 || x==1 || x==2);
^
Seasun.java:20: 错误: 有 'if', 但是没有 'else'
else
^
2 个错误












