Do Java 8 default methods break source compatibility?

后端 未结 5 1232
日久生厌
日久生厌 2020-11-30 05:24

It has generally been the case the Java source code has been forward compatible. Until Java 8, as far as I know, both compiled classes and source have been forward

5条回答
  •  独厮守ぢ
    2020-11-30 05:55

    Reading this issue, I was thinking of its solution.
    Default methods have solved the backward compatibility problems but forward compatibility issues will exist.
    I think instead of extending existing classes, in such cases, we can have our application specific interfaces to add some desired behaviour to our class. We can implement this application specific interface and use it.

提交回复
热议问题