本帖最后由 wangleixhlm 于 2014-5-26 22:02 编辑
- class FatherClass
- {
- public FatherClass()
- {
- System.out.println("FatherClass Create");
- }
- }
- public class ChildClass extends FatherClass
- {
- public ChildClass()
- {
- System.out.println("ChildClass Create");
- }
- public static void main(String[] args)
- {
- FatherClass fc = new FatherClass();
- ChildClass cc = new ChildClass();
- }
- }
复制代码
为什么会输出这个结果?两次FatherClass Create:
E:\My Document\test>java ChildClass
FatherClass Create
FatherClass Create
ChildClass Create
不科学啊。。 |