为什么我在编译时出现Expection in thread "main" java.lang.NoSuchMethodError: main

来源:百度知道 编辑:UC知道 时间:2024/05/05 21:16:34
问题如题 下面附上源代码
class BigInt
{
int a;
int b;
int add()
{
return a+b;
}

void compare()
{
if (a==b) System.out.println("a=b");
else if (a<b)
System.out.println("a<b");
else System.out.println("a>b");
}

void out()
{
System.out.println("a="+ a + " b=" + b);
}
}
class BigIntTest
{
public static void main(String[] args)
{
BigInt bigInteger= new BigInt();
bigInteger.a=2000;
bigInteger.b=2500;
bigInteger.add();
bigInteger.compare();
bigInteger.out();
}
}
你们编译为什么都没问题啊 我怎么编译的时候会有Expection in thread "main" java.lang.NoSuchMethodError: main
这个错误跳出来呢?
各位谁告诉我哪里的环境变量没设置好 最好详细点!
我的系统是Vista 环境变量都已经设置好了 但是还是不能运行 还是会跳出这个错误

没有错误啊,我试过了

输出结果:
a<b
a=2000 b=2500

环境变量没配置好.仔细检查一遍.

我也试过了,没有错误,结果如楼上的

你确定是在编译时出错而不是在执行的时候?执行时:java 类名 //这个类名是main方法所在类