eclipse中的构造方法的警告,请问这是为什么?
下面的程序:
class Test2
{
	public void Test2()
	{
		System.out.println("the base class's construstor");
	}
}
public class TestDemo2 extends Test2 {
	public void TestDemo2()
	{
		System.out.println("the derive class's construstor");
	}
	public static void main(String [] args)
	{
		new TestDemo2();
	}
}
如果运行的话,根本得不到任何结果(控制台看不到输出结果)。
但是如果把上面两个类的构造方法前面的void关键字
都去掉,那么可以运行,结果是:
the base class's construstor
the derive class's construstor
请问这是为什么呢?
------解决方案--------------------构造方法前面 好像不需要void吧,加了void 就不是构造函数了
------解决方案--------------------你刚学Java吧 好好看书,构造方法 是没有返回值的,遇到错误,先自己考虑 实在不行再问别人,这才对你的成长有好处啊
------解决方案--------------------基础知识还没过关  还是先看书吧