欢迎光临
我们一直在努力

Overloading and Overriding(English)-JSP教程,资料/其它

建站超值云服务器,限时71元/月

overloading:
signature has to be different. just a difference in return type is not enough.accessibility may vary freely.exception list may vary freely.just the name is reused. methods are independent methods. resolved at compile-time based on method signature.can call each other by providing appropriate argument list.

overriding:
signature has to be the same. (including the return type)overriding methods cannot be more private than the overridden methods.overriding methods may not throw more checked exceptions than the overridden methods.  but can throw no exception.related directly to sub-classing. overrides the parent class method. resolved at run-time based on type of the object.overriding method can call overridden method by super.methodname(), this can be used only to access the immediate super-class’s method.super.super won’t work. also, a class outside the inheritance hierarchy can’t use this technique.

 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Overloading and Overriding(English)-JSP教程,资料/其它
分享到: 更多 (0)