Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Core Java Interview Questions and Answers

Ques 126. How can a subclass call a method or a constructor defined in a superclass?

Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass‘s constructor.

Is it helpful? Add Comment View Comments
 

Ques 127. Can an anonymous class be declared as implementing an interface and extending a class?

An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

Is it helpful? Add Comment View Comments
 

Ques 128. When does the compiler supply a default constructor for a class?

The compiler supplies a default constructor for a class if no other constructors are provided.

Is it helpful? Add Comment View Comments
 

Ques 129. What is composition?

Holding the reference of the other class within some other class is known as composition.

Is it helpful? Add Comment View Comments
 

Ques 130. What is aggregation?

It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2021 WithoutBook