Why do we need to specify parameter name in interface?

前端 未结 3 1874
离开以前
离开以前 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条回答
  •  旧时难觅i
    2021-02-04 01:23

    My take on this:

    1. This is in language specification for parameters to have names;

    2. Interface being interface, names help to communicate the meaning;

    3. Interface is not really a forward declaration of implementation that will follow like in C/C++, so comparison is not entirely correct;

提交回复
热议问题