It is defined as an abstract type used to specify the behavior of a class. The interface consists of static constants and abstract methods. Multiple interfaces cannot be implemented by a java class. Interfaces are declared using the interface keyword. The methods inside the interface are implicitly public and abstract.
Interface
{
//methods
}
The Java interface can only have abstract methods, not method bodies. In Java, it is used to achieve abstraction as well as multiple inheritance. To put it another way, interfaces can have abstract methods and variables. It isn't allowed to have a method body.
A marker or tagged interface has no members, such as Serializable, Cloneable, Remote, etc. They're used to give the JVM some crucial information so that it can conduct some essential tasks.
knowledge2life
website
|