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
According to java operator precedence, which operator is considered to be with highest precedence?
How to perform quicksort in java?
Why is method overloading not possible by changing the return type in java?
Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview
What do you understand by the bean persistent property?
How to make a write-only class in java?
Explain the difference between abstract classes and interfaces in java?
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
Can we split string with in java?
Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?
What is hashset in java?
What is the driver class?
What are structs in java?
Why destructor is not used in java?
What occurs when an object is constructed?