Interfaces
Interfaces
CLASS INTERFACE
> In class, you can instantiate variables > In an interface, you can’t instantiate
and create an object. variables and create an object.
> Class can contain concrete (with > The interface cannot contain
implementation) methods. concrete(with implementation) methods.
Java program to demonstrate working of interface
Advantages of Interface
Without bothering about the implementation part, we can achieve the security of
the implementation.
In Java, multiple inheritance is not allowed, however, you can use an interface to
make use of it as you can implement more than one interface.
Ex – extends keyword is used for an interface to extend more than one interface
syntax:
public interface xx extends y, z
THANK YOU!!