Why do we need to specify parameter name in interface?

前端 未结 3 1864
离开以前
离开以前 2021-02-04 00:45

When we create interface methods, can\'t we do something like in java:

void interface_method(Integer,String, /* other parameter */);
         


        
3条回答
  •  离开以前
    2021-02-04 01:21

    From a technical standpoint it wouldn't be necessary.

    I've always taken it as a syntax normalization, and a documentation aid.

    This way there's:

    1. No reason to differentiate between class and interface method syntax, and
    2. Default Javadoc documentation can be generated using the (descriptive!) parameter name.

提交回复
热议问题