![]() |
#2
纵横阳仔2016-12-18 14:26
|

package zs1;
import javax.swing.JOptionPane;
public class zs12
{
public static void main(String args[])
{
int month= 4;
String season;
if(month == 12 ||month == 1 ||month == 2);
{season = "冬天";}
else if(month == 3||month == 4||month == 5);
{season = "春天";}
else if(month == 6|| month== 7||month == 8);
{season = "夏天";}
else if(month == 9||month == 10||month == 10);
{season = "秋天";}
else
{season = "不合法的月份";}
JOptionPane.showMessageDialog(null,"四月是" + season +".");
System.exit(0);
}
}
import javax.swing.JOptionPane;
public class zs12
{
public static void main(String args[])
{
int month= 4;
String season;
if(month == 12 ||month == 1 ||month == 2);
{season = "冬天";}
else if(month == 3||month == 4||month == 5);
{season = "春天";}
else if(month == 6|| month== 7||month == 8);
{season = "夏天";}
else if(month == 9||month == 10||month == 10);
{season = "秋天";}
else
{season = "不合法的月份";}
JOptionPane.showMessageDialog(null,"四月是" + season +".");
System.exit(0);
}
}
报错:Syntax error on token "else", delete this token