what is the purpose of method overriding in java where v r
completely re-defining a inherited method instead y can't v
create a new method and define.If the question is very silly
plz excuse me and do reply.Thank U!

Answer Posted / sridharan

We know method overriding will be coming in inheritance.
Consider a mother and her daughter.
Lets think mothers will cook, so her daughter will also
cook. One day mother cooked a biryani for her daughter. By
using the method

cookBriyani(rice,vegetables,water,salt). {

// mother style of cooking
}
But her daughter didn’t like it. So her daughter decided to
prepare biryani by herself. She is also going to use same
ingredients but she is going to prepare in her style.
Daughter method is

cookBriyani(rice,vegetables,water,salt){
// daughter style of cookling
}
Daughter made also biryani so without changing the
name i.e cookBriyani(), also she used same ingredients (i.e
rice,vegetables,water,salt) i.e same parameter but she
prepared in different style.

Is This Answer Correct ?    67 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is final different from finally and finalize?

496


Is java a digit method?

520


How to optimize the javac output?

602


What is the use of toarray () in java?

545


Can you add null to a list java?

586






Why does java does not support multiple inheritance? Explain

549


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

565


What is lambda programming?

498


what is the volatile modifier for? : Java thread

523


What are the disadvantages of using inner classes?

557


What is bubble sort in java?

619


What is a conditional statement explain with example?

543


I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com

1079


What is difference between equals and hashcode method?

573


What is boolean keyword in java?

604