Interface in java


 

Interface in java

In this scjp tutorial you will learn about the interface.

In this scjp tutorial you will learn about the interface.

An interface must be declared with the keyword interface. An interface is 100% pure abstract class that's mean an interface can have only abstract method, no concrete methods exists. A single class can implement many interfaces. Interface methods are by default public and abstract, you can explicitly declare these modifiers which is optional. Interface can have constants which are implicitly public, static and final and it declaration is optional in any combination. An abstract class can implement an interface. A class can able to extend only one class but it can implements many interfaces. An interface can extends one or more other interfaces. Interface cannot extends a class. Interface methods must not declare static. Interface have all methods abstract so it must not marked final, strictfp, or native.


The above concept can be viewed in examples provided in next page.

Ads