abstract
(only method signature, no body).
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.
abstract
.
Comparator
interface, which imposes a total ordering on some collection of objects.
If a class implements this interface, then it can be used to sort a collection.
The syntax for declaring an interface is given on the right: |
|
interface
keyword.
It is used to provide total abstraction.
That means all the methods in interface are declared with empty body and are public
and all fields are public
, static
, and final
by default.
A class that implements interface must implement all the methods declared in the interface.
To implement interface use implements
keyword.