抽象类问题(没分了,大家见谅!)
XSign 2008-04-29 08:00:44 abstract class b
{
abstract void user();
}
class c extends b
{
void user()
{
System.out.println("Hello Hacksign!");
}
}
public class test extends c
{
public void main(String [] args)
{
user();
}
}
编译通过,但是运行错误:
Exception in thread "main" java.lang.NoSuchMethodError: main
这里有两个问题
1、为什么main方法需要为static类型?
2、我将main方法定义为static类型后,编译提示无法从静态方法中引用非静态方法,将user()前加上static关键字后,又报错不能实现user()方法。。。郁闷,为什么?