Interface Interview Questions in Java

Advertisements

Prev Tutorial Next Tutorial

Interview Questions on Interface in Java

.

What is Interface ?

An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface..

Main features of Interface ?

  • Interface cannot be instantiated
  • An interface does not contain any constructors
  • All of the methods in an interface are abstract

Can an Interface be final ?

No, because its implementation is provided by another class.

What is marker interface ?

An interface that have no data member and method is known as a marker interface.For example Serializable, Cloneable etc.

What is difference between abstract class and interface ?

An abstract class can have method body (non-abstract methods) but Interface have only abstract methods.

How to implement Interface in Java ?

Syntax

interface A
{
....
....
}
interface B
{
....
....
}
class C implements A,B
{
....
....
}

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements