Final arguments in interface methods - what's the point?

前端 未结 5 1908
甜味超标
甜味超标 2020-11-28 03:26

In Java, it is perfectly legal to define final arguments in interface methods and do not obey that in the implementing class, e.g.:

public inter         


        
5条回答
  •  囚心锁ツ
    2020-11-28 04:04

    Final annotations of method parameters are always only relevant to the method implementation never to the caller. Therefore, there is no real reason to use them in interface method signatures. Unless you want to follow the same consistent coding standard, which requires final method parameters, in all method signatures. Then it is nice to be able to do so.

提交回复
热议问题