在看Overload的定义的时候有这么一句话:
There is no required relationship between the return types or between
the throws clauses of two methods with the same name, unless their signatures
are override-equivalent.
Overload与return type和throws clauses都没关系吧?应该只与method signature有关
但它那句unless their signatures are override-equivalent搞得我就不理解了
希望大侠们帮帮忙
There is no required relationship between the return types or between
the throws clauses of two methods with the same name, unless their signatures
are override-equivalent.
Overload与return type和throws clauses都没关系吧?应该只与method signature有关
但它那句unless their signatures are override-equivalent搞得我就不理解了
希望大侠们帮帮忙
不要太拘泥于文字,意思理解就行了
the throws clauses of two methods with the same name, unless their signatures
are override-equivalent.
这句话本人理解为:重载的两个方法的返回类型和抛出异常语句没有特定的关系,除非他们相当于覆盖那样。言外之意就是覆盖的两个方法的返回类型和抛出异常语句是有一定关系的。lz的理解是正确的。