can u give some realtime example in ploymorphism? and
inheritance?

Answers were Sorted based on User's Feedback



can u give some realtime example in ploymorphism? and inheritance?..

Answer / mani

Human being life is the best example for ploymorphism bcoz
Let one take example
im a son of my parents and also brother of my sister and
the employee of one company ...
Im playing the many role here.
Same example for inheritance also bcoz i have inherited my
father property.

Is This Answer Correct ?    58 Yes 4 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / suresh

inheritance is hierarchy of class,that is one class derived
from another class

example:
grant father
--father
--son

polymorphism is the ability to take more than one form

example:
compile time polymorphism
--method overloading
people can act many role in the world
home:father
company:employee
run time polymorphism
--method overriding
dog is a class
It contains smile method

Is This Answer Correct ?    36 Yes 15 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / srinu

polymorphism: Polymorphism one form existing many forms is
called polymorphism.its used for over ridding.

EX:Man
Because A Man go to office he is an Employee.
A Man go to movie he is an auditor.
A man walk with his lover she's boy friend



inheritance is hierarchy of class,that is one class derived
from another class

EX:

grant father
--father
--son

Is This Answer Correct ?    19 Yes 8 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / walkinglegendteja

Inheritance is a concept which involves the concept of re
usability Ex:Bank Accounts-->SB Account,RD Account,CD Account
Polymorphism concept of one existing in many forms
Ex:In Graphical User interfaces,AWT

Is This Answer Correct ?    26 Yes 17 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / sai vamsi krishna

An Inheritance is to access the properties from super class to sub class.
example father to son sometmes the father has some diseases like sugar,BP those are attacking to son also.
poymorphism means many forms
example one person acts as many roles in his life a person works at company he is a employee at the same time he is a father of his son.

Is This Answer Correct ?    6 Yes 0 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / abdulrazak

abstract class Person
{
public String sname(){}
Address ad;
}
class Patient extends Person
{

}
class Employee extends Person
{
}
Here in the above example Person is a class acting two ways
one Patient details info and Employee details. We are
achieving this extends Person i.e inheritence.Inheritence
provides code reusability,extensibility

Is This Answer Correct ?    10 Yes 5 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / nazneen

Polymorphism applies to Overriding
Inheritance applies to Reusability of code defined earlier in one Class and later on used by Other Classes..

Is This Answer Correct ?    14 Yes 11 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / babu

Babu torati

METHOD OVERLOADING:Means suppose one man behaving different ways
suppose if is meet his wife he feels different if he meet his girl friend he feels differently means Based on person he meet his behavior will changes.


METHOD OVERRIDING:Means if father is gives some Properties to his son. ex:Bike but father says if you want to change this bike your wish otherwise continue with this bike(i.e no restriction) means gives permission throw the virtual keyword if you want change(override).

Is This Answer Correct ?    3 Yes 0 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / ashish rathore

Inheritence is a process by which object of one class aquire
the property of any object of another class. it provides the
idea of reusearility.
this means the ability to take more than one form from
existing class without modifying it.

Is This Answer Correct ?    5 Yes 3 No

can u give some realtime example in ploymorphism? and inheritance?..

Answer / dharmaraj

As i dont know these is correct answer but my knowledge is ok.

METHOD OVERLOADING: In one women got many children
(same method name but different parameter).

METHOD OVERRIDING: In women married in two different persons.
(one method two override the another method)

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More Servlets Interview Questions

What are the difference between RMI and Servlets?

0 Answers  


What is a deployment descriptor?

0 Answers  


What is Single Threaded Model in Servlets? Explain this with an example?

10 Answers   Wipro,


What are the different session tracking techniques?

0 Answers  


Which is the methods of generated servlet?

0 Answers  






Explain Action Servlet?

0 Answers   Cap Gemini,


what is SSL?

3 Answers  


I have a requirement Here we have a ResultSet object that will contain 50 records i need to print those recors in to a webpage(i.e; view according to MVC architectures that mybe servlet or jsp) . Here i need to print the records 10 per page that is 1 to 10 in page one and 11 to 20 in page two like remaining will be appeared in other pages we need to display those page numbers whenever we click on that page number we will go to that page and display 10 records like we will display 5 pages it is like this << 1 2 3 4 5 next >>

0 Answers   ProKarma,


difference between request.getSession(false) or request.getSession() and request.getSession(true)

2 Answers  


What is the use of java servlet api?

0 Answers  


What is meant by cookies?

0 Answers  


can i override service method

3 Answers   Intelligroup,


Categories