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

原文链接:What is interface

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容