I have seen many posts saying an interface is bounded by a contract which specifies the way in which it's methods should be implemented. But couldn't get what is meant by that. Could you please explain?
Asked
Active
Viewed 38 times
0
-
2Just to make it very short: an interface is NOT bound by a contract: the interface IS the contract. The classes implementing the interface are bound by it. – Stultuske Jan 21 '16 at 13:13
-
gotcha. thanks @Stultuske – Pradeep Kumaresan Jan 21 '16 at 13:19
-
This is said because if a class implements an interface it must provide all¹ the classes specified in the interface or the code won't compile. (¹ Except where Java 8 has polluted interfaces with `default` methods). – John Hascall Jan 21 '16 at 13:23