Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Highest level event class of the event-delegation model?

3972


What is the new line character?

1134


Can we serialize arraylist in java?

975


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

1048


What is difference between printf and scanf?

1076


How to print nodes of a Binary tree?

2219


What technique can be employed to compare two strings?

1048


What is thread life cycle in java?

1026


What is JVM and is it platform independent?

1013


What is the difference between static binding and dynamic binding?

1069


Explain the different forms of polymorphism?

964


What is computer compiler?

953


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?

976


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

1040


How do you sort arraylist in descending order?

995