Friday, October 5, 2012

Interface

What is an interface ?
An interface is a specification of method prototypes, All the methods of the interface are public and abstract.


Why the methods of interface are public and abstract by default ?
Interface methods are public since they should be available to third party vendors to provide implementation. They are abstract because their implementation is left for third party vendors.


Can you implement one interface from another ?
No, we can’t implementing an interface means writing body for the methods. This can not be done again in an interface, since none of the methods of the interface can have body.

Can you write a class within an interface ?
Yes, it is possible to write a class within an interface.




No comments:

Post a Comment