Java Interview Questions & Answers part 6

0
522
Q: – Can we create an object for an interface?

Yes

Q: – Is it is necessary to implement all methods in an interface?

Yes

Q: – How this() is used with constructors?

this() is used to invoke a constructor of the same class.

Q: – Is it possible to use few methods of an interface in a class ? If so, how?

Yes. Declare the class as abstract.

Q: – What are the possible access modifiers when implementing interface methods?

public

Q: – What modifiers are allowed for methods in an Interface?

public
abstract

Q: – How do you achieve multiple inheritances in Java?

We canuse interfaces.

Q: – How super() used with constructors?

super() is used to invoke a super class constructor

Q: – What is an abstract class?

Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation.

Submitted By:-Ankur Jain           Email-ID: – ankurjain548@gmail.com

SHARE

LEAVE A REPLY