Java中运行时出现selection dose not contain a main type是怎么回事?
定义的季节类publicclassseason{intmonth;publicvoidShowSeason(){switch(month){case1:System.ou...
定义的季节类
public class season {
int month;
public void ShowSeason(){
switch (month){
case 1:
System.out.println("该季节为春季");
break;
case 2:
System.out.println("该季节为春季");
break;
case 3:
System.out.println("该季节为春季");
break;
case 4:
System.out.println("该季节为夏季");
break;
case 5:
System.out.println("该季节为夏季");
break;
case 6:
System.out.println("该季节为夏季");
break;
case 7:
System.out.println("该季节为秋季");
break;
case 8:
System.out.println("该季节为秋季");
break;
case 9:
System.out.println("该季节为秋季");
break;
case 10:
System.out.println("该季节为冬季");
break;
case 11:
System.out.println("该季节为冬季");
break;
case 12:
System.out.println("该季节为冬季");
break;
}
}
}
输出信息
import java.util.*;
public class Ssn {
public static void mian(String[]args){
Scanner input=new Scanner(System.in);
season s=new season();
System.out.println("请输入月份:");
s.month =input.nextInt();
s.ShowSeason();
}
}
运行的时候如果选择Java Applet
那么有错误框Selection does not contain an applet
如果选择Java Application
那么有错误框Selection does not contain a main type
求高手指点。 展开
public class season {
int month;
public void ShowSeason(){
switch (month){
case 1:
System.out.println("该季节为春季");
break;
case 2:
System.out.println("该季节为春季");
break;
case 3:
System.out.println("该季节为春季");
break;
case 4:
System.out.println("该季节为夏季");
break;
case 5:
System.out.println("该季节为夏季");
break;
case 6:
System.out.println("该季节为夏季");
break;
case 7:
System.out.println("该季节为秋季");
break;
case 8:
System.out.println("该季节为秋季");
break;
case 9:
System.out.println("该季节为秋季");
break;
case 10:
System.out.println("该季节为冬季");
break;
case 11:
System.out.println("该季节为冬季");
break;
case 12:
System.out.println("该季节为冬季");
break;
}
}
}
输出信息
import java.util.*;
public class Ssn {
public static void mian(String[]args){
Scanner input=new Scanner(System.in);
season s=new season();
System.out.println("请输入月份:");
s.month =input.nextInt();
s.ShowSeason();
}
}
运行的时候如果选择Java Applet
那么有错误框Selection does not contain an applet
如果选择Java Application
那么有错误框Selection does not contain a main type
求高手指点。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |