java_inheritance | java_inheritance
kandi X-RAY | java_inheritance Summary
kandi X-RAY | java_inheritance Summary
java_inheritance
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of java_inheritance
java_inheritance Key Features
java_inheritance Examples and Code Snippets
Community Discussions
Trending Discussions on java_inheritance
QUESTION
When we use inheritance in java can we inherit constructor of the super class by the subclass?
At tutorialspoint it says:
A subclass inherits all the members (fields, methods, and nested classes) from its superclass. Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.
But in somewhere the same tutorial said that:
If a class is inheriting the properties of another class, the subclass automatically acquires the default constructor of the superclass.
So I want to know can a subclass inherit the constructor of the super class?
...ANSWER
Answered 2017-May-20 at 02:43You can access super class constructors with super keyword.
You need to define the constructor in the sub class and invoke the super constructor.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install java_inheritance
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page