Is it right to understand that the only reason why it is possible to implement a large enough ( 65535 ) Interface in Java is that the Interface having no implementation, does not have memory for storing data ?
- 3Starting in Java 8 , the interface may have a default implementation. - user194374
- oneWell, not the only one, of course. More important is the meaning . - VladD
- @VladD but of course :), where in programming without meaning ... - TimurVI
- And what could be the reasons that it was not possible? - Regent
- Interesting was the connection with the allocation of memory for storage - TimurVI
|
1 answer
Initially, interfaces are a way to create "multiple" inheritance without multiple inheritance. The interface is a contract, it guarantees that a certain object has methods with the signatures described in the interface. Since java uses the concept of calling a method, rather than sending a message (as suggested in the first OOP model), the compiler needs this contract to check the code.
|