An abstract type used to specify the behavior of a class
Interface in Java
A blueprint of a class
Interface in Java
Contains static constants and abstract methods
Interface in Java
Methods declared in an interface are by default abstract (only method signature, no body)
Interface
Specifies what a class must do and not how. It is the blueprint of the class
Interface
About capabilities like a Player may be an interface and any class implementing Player must be able to (or must implement) move(). So it specifies a set of methods that the class has to implement
If a class implements an interface and does not provide method bodies for all functions specified in the interface, then the class must be declared abstract
Interfaces are used to implement abstraction. So the question arises why use interfaces when we have abstract classes?
The major differences between a class and an interface are:
In class, you can instantiate variables and create and object.
Class can contain concrete(with implementation) methods.
The access specifiers with classes are private, protected, and public.
In an interface, you cant instantiate variables and create an object.
The interface cannot contain concrete(with implementation) methods.