Computer Scientists are Pretty Pessimistic

Sunday 28 August 2016

Interfaces in JAVA

Interfaces :-

* Using interface you can specify what a class must do.

* Variables in interface always final and static by default.

* All methods and variables are implicitly public.

* One or more classes can implement an interface.

* A class implements more than one interface.

Some Restriction of Interface :-

* You can not instantiate an interface. (you won't create an object)

* An interface doesn't contain any constructors.

* All of the methods in an interface are abstract.

* An interface can't contain instance fields. The only fields that can appear in an interface must be declared both static and final.

* An interface is not extended by a class, it is implemented by a class.

* An interface can extend multiple interfaces.

No comments:

Post a Comment