Are Java constructors inherited? Answer:
No. 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.
Do constructors have return types? Answer: No. Only methods have return types.
How many constructors will be invoked in an object's inheritance tree? Answer: All of the constructors in an object's inheritance tree will be invoked when the object is instantiated using new.
How can a constructor invoke another constructor of the same class? Answer: A constructor can invoke another constructor of the same class using the this keyword .
What must every constructor have in the first line of its body? Answer: Every constructor must have
as the first statement (although the compiler can insert this for you).
Have both 1) this and 2) super in the first line of a constructor will cause a compiler error.
What is characteristic of class variables? Answer: Static members are tied to a class and not to an instance.
How do you access a static member? Answer: Use the class name with the dot operator.
How is the IS-A relationship expressed? Answer: The IS-A relationship is expressed with the keyword extends.
What is true about reference variables in Java? Answer: A reference variable is always of a single unchangeable type, but it can refer to a subtype object.
Can constructors be overridden in Java? Answer: No.Constructors can be overloaded but not overridden because constructors are not inherited. Notes:
1. A reference variable can refer to a subtype object.