explain method overridding method overloding with examples?

Answer Posted / muthusenthil

method overloading is to load some extra features in
existing method eg: a method takes string as an arguments
but overloaded method may take int along with String
trapPerson(String name)- pre-existing method
trapPerson(String name,int age)- overloaded method
(irrespective of return type)
this may take place in same class or derived clas

method overridding is to override a method from parentclass
to change its behaviour.name should be same as parentclass
method, behaviour may change
it should takes place between derived class
eg: class man extends superman
int walk() be one among characterstics of man overridden by
superman.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is package name in struts xml?

563


What is the purpose of @validations annotation?

570


Why use spring, if you are already using struts?

558


Why do the struts tags provide for so little formatting?

586


What are the differences between http direct and http indirect?

469






What is purpose of execandwait interceptor?

581


What is the purpose of @intrangefieldvalidator annotation?

856


What is the purpose of @after annotation?

591


How an actionform bean is created?

569


What are the classes used as part of struts framework ?

523


What is the purpose of @beforeresult annotation?

575


How can we get Servlet API Request, Response, HttpSession etc Objects in action classes?

626


What are the advantages of spring mvc over struts mvc?

497


What is an interceptor stack?

575


What is the difference between Jakarta Struts and Apache Struts? Which one is better to use?

576