An interface is a group of related methods with empty bodies.
Example :
Interface interfaceDemo
{
public void msgPrint();
}
Some facts about interface:
o Interface methods are by default public abstract.
o Interface variables are by default public static final.
o We can’t declare interface method private.
o We can’t make object of an interface.
o We can’t extend an interface in class but we can implements it.
o We can do multiple inheritance through interface.
No comments:
Post a Comment