Java Programming - Declarations and Access Control - Discussion
Discussion Forum : Declarations and Access Control - Pointing out the correct statements (Q.No. 5)
5.
class A
{
A( ) { }
}
class B extends A
{ }
Which statement is true?Answer: Option
Explanation:
Option B is correct. Class B inherits Class A's constructor which has no arguments.
Option A is wrong. Class B inherits Class A's constructor which uses default access.
Option C is wrong. There is just no implicit call to this( ).
Discussion:
11 comments Page 2 of 2.
Vandit said:
3 years ago
@All.
Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.
Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers