What is an interface How is extending a class different fro

What is an interface ?

How is extending a class different from implementing an interface ?

Solution

Interface :-

Interface is also one type class; it is a fully un-implemented class. It is used for creating a new type of object only by declaring set of operations of this object. So interface contains only public static final variables and public abstract methods for declaring object operations. Interface is mainly introduced to develop multiple implementation inheritance.

How is extending a class different from implementing an interface ?

Because a class can extend an another class.

But one and only a class implements an interface.

Example :-

Interface I1 { }

Interface I2 { }

class A { }

class c extends A { }

class c extends A implements I1,I2 { }

What is an interface ? How is extending a class different from implementing an interface ?SolutionInterface :- Interface is also one type class; it is a fully u

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site