http://topic.youkuaiyun.com/t/20021031/11/1136699.html
原题如下:
Which of the following statements are true?
1) Constructors are not inherited
2) Constructors can be overriden
3) A parental constructor can be invoked using this
4) Any method may contain a call to this or super
请问,为什么4)不对?
answer1. 应该是因为 静态方法吧,在静态方法中不能用 this super
answer2. super方法只能在构造方法中的第一句才能调用,所以D是错误的
原题如下:
Which of the following statements are true?
1) Constructors are not inherited
2) Constructors can be overriden
3) A parental constructor can be invoked using this
4) Any method may contain a call to this or super
请问,为什么4)不对?
answer1. 应该是因为 静态方法吧,在静态方法中不能用 this super
answer2. super方法只能在构造方法中的第一句才能调用,所以D是错误的
构造函数特性解析
本文针对构造函数的继承、重写及调用进行了深入探讨,并解释了为何无法在所有方法中调用this或super的原因。
3007

被折叠的 条评论
为什么被折叠?



