Access characteristics of constructors in Java inheritance
The
- subclass constructor has a default implicit “super()” call, so it must be the parent constructor called first and the subclass constructor executed later. Subclass constructs can be invoked with the super keyword to call superclass overloaded constructs. Super’s superclass constructor call must be the first statement of the subclass constructor. A subclass construct cannot call the super construct more than once.
Conclusion:
subclasses must call the superclass constructor, don’t write gives super (); You can only have one super, and it has to be the first one.
Read More:
- Initialization order of Java objects
- C++ Error: allocating an object of abstract class type
- Cause check of unreachable statement exception in Java
- Abstract precautions
- Error record: this.requestWindowFeature ( Window.FEATURE_ NO_ Title) error or no effect
- Python – get the information of calling function from called function
- “Method does not override method from its superclass”
- [How to Fix] Fatal error: init(coder:) has not been implemented
- Common errors and modification methods of findbug
- Experience of using on error resume next in VBScript
- Macro generated_ UCLASS_ Body () and generated_ Analysis of body ()
- Error inflating class in WebView in Android 5. X android.webkit.WebView Solutions
- Sorting out MySQL “too many connections” solutions
- Pytorch — nn.Sequential () module
- C + + uses system (“pause”) to pause black windows
- Error c2064: term does not evaluate to a function in VC
- Error receiving broadcast Intent { act=com.supersdk.listen.PayListen_defeat flg=0x10 (has extras)
- Mac php7.4.13 using PECL installation extension to report error
- Vtkrenderwindow and vtkrenderwindow actor
- Apawn class, add axis mapping to control apawn movement