DEV Community

Dinesh Kumar
Dinesh Kumar

Posted on

What is interface

Interface
Inteface is basically a contract with the class that if you want to use this interface you have to do this stuff(the methods defined in the class) and if you don't then you won't be able to proceed and the best part it that it totally depends on you how you are going to achinve the funtionality.

E.G. The banking system
Every bank performs some common tasks like Withdraw, deposite, check Balance etc. but every bank has its own way of doing it.
The code that run behinds or the procedure the follow may differ but ultimate goal is to do deposite, withdraw or check balance.
So, the bank governing authority give them an interface that have three abstract methods e.g.
deposite(int howmuch), withdraw(int howmuch), checkBalance(int actno);

Checkout full video on Interface in java here

Top comments (0)