I’m learning about Java interfaces and method writing. I’m wondering how you would create a class that uses this interface?
Also what are the best ways to implement the methods it includes?
At the moment, i’m trying to learn different ways for writing methods.
Thanks in advance for your help 🙂
interface Dealer {
void assignPlayers(ArrayList<Player> p);
...
public void settleBets();
}
It’s simple:
It’s not about the best way; this is the only way. You must either implement all the methods in the interface or declare the class
abstract.The interface need not use the
publickeyword; all the methods in an interface are public by default.