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
What is a lambda expression ? What's its use ?
What is nullpointerexception?
Where can I find jdk in my computer?
What is the difference between a method and a function in alice?
What is currentthread()?
Is arraylist ordered in java?
What is the difference between logical data independence and physical data independence?
Why is stringbuffer thread safe?
What is the difference between a scrollbar and a scrollpane?
What’s a deadlock?
Can a static class have a constructor java?
What is the nested interface?
What is indexof in java?
What are the advantages of functions?
What is variable declaration and definition?