0

可能重复:
覆盖静态方法和最终方法

子类main方法会覆盖超类main吗?希望超类中的主要方法被执行。请解释

4

2 回答 2

3

main method is static method and static methods are not overridden.

So if you are calling Super.main(args[]) then main method of super class is called and if you are calling Child.main(args[]) then main method of child class will be called.

于 2012-10-13T06:58:25.977 回答
1

Static method are not overridden. 每个类都有自己的静态方法,它们永远不会被继承,因此它永远不会被覆盖为main is static

于 2012-10-13T07:12:12.307 回答