Method has the same erasure as another method in type

前端 未结 7 851
时光取名叫无心
时光取名叫无心 2020-11-22 05:50

Why is it not legal to have the following two methods in the same class?

class Test{
   void add(Set ii){}
   void add(Set ss){}         


        
7条回答
  •  萌比男神i
    2020-11-22 06:27

    Define a single Method without type like void add(Set ii){}

    You can mention the type while calling the method based on your choice. It will work for any type of set.

提交回复
热议问题