java 找不到符号
java初学者,CT类里的gai()和mian()前提示错误找不到符号,自己改了半天不行,求大神指导
import java.util.*;
public class CT{
public static void main(String[] args)throws Exception
{
Scanner scan=new Scanner(System.in);
boolean b=true;
while(b){
System.out.println("*****欢迎进入食堂点餐系统*****");
System.out.println(" 1.盖饭类");
System.out.println(" 2.小碗菜");
System.out.println(" 3.面食类");
System.out.println(" 4.其他");
System.out.println(" 5.退出");
System.out.print("请选择:");
int a=scan.nextInt();
switch(a)
{
case 1:
gai();
break;
case 2:
break;
case 3:
mian();
break;
case 4:
break;
case 5:
b=false;
break;
}
}
Thread.sleep(5000);
System.out.println("谢谢使用!");
}
}
class gai{
public void gai(){
Scanner scan1=new Scanner(System.in);
boolean c=true;
while(c){
System.out.println(" 1.宫保鸡丁盖饭");
System.out.println(" 2.地三鲜盖饭");
System.out.println(" 3.土豆牛肉盖饭");
System.out.println(" 4.鱼香烘蛋盖饭");
System.out.println(" 5.葱爆羊肉盖饭");
System.out.println(" 6.重新选择");
System.out.print("请选择:");
int d=scan1.nextInt();
switch(d)
{
case 1:
case 2:
case 3:
case 4:
case 5:
System.out.println("请稍等...");
break;
case 6:
c=false;
break;
}
}
}
}
class mian{
public void mian(){
Scanner scan2=new Scanner(System.in);
boolean e=true;
while(e){
System.out.println(" 1.红烧牛肉面");
System.out.println(" 2.茄子鸡丁面");
System.out.println(" 3.羊肉面");
System.out.println(" 4.清汤面");
System.out.println(" 5.西红柿鸡蛋面");
System.out.println(" 6.重新选择");
System.out.print("请选择:");
int f=scan2.nextInt();
switch(f)
{
case 1:
case 2:
case 3:
case 4:
case 5:
System.out.println("请稍等...");
break;
case 6:
e=false;
break;
}
}
}
}
------解决方案--------------------没检查括号是否匹配,大概调整了下方法的位置:
import java.util.*;
public class CT{
public static void main(String[] args)throws Exceptio