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 / kv

The answer lies in Object Oriented concept. When you are
overriding a method, you overriding the internal details of
default behavior. But your interface to external world is
not changed. Example, Base class employee has a method
commuteToWork(). All the manager in the company has given
the company car and a driver. Their implementation of
commuteToWork will be different from the non manager
employees. If you add a new method saying
commuteToWorkByCar(), every Monday morning you would need to
call different method for each subtype of employee. Hope it
will help.

Is This Answer Correct ?    13 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to Sort Strings which are given in List and display in ascending order without using java api.

4423


Can we declare register variable as global?

927


Can you extend singleton class?

1091


Why does java does not support multiple inheritance? Explain

966


How to display names of all components in a Container?

2933


Can inner class extend any class?

1052


What are the restrictions imposed by a Security Manager on Applets?.

2610


What is the list interface in java programming?

1103


If an application has multiple classes in it, is it okay to have a main method in more than one class?

1007


How can we create objects if we make the constructor private ?

989


What is multi level inheritance in java?

1019


Are strings immutable in java?

971


How do you check if a character in a string is a digit or letter?

1065


What are the differences between c++ and java?

1124


What happens when you add a double value to a string?

983