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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do we go with database connection and log4j integration in servlet?

700


What is servlet lazy loading?

693


What are the exceptions thrown by servlets? Why?

622


Whats the advantages using servlets over using CGI?

584


What is cookies in servlet with example?

518






Is servlet a controller?

573


How can the referrer and the target urls be used in servlet?

529


Why do we need a constructor in a servlet if we use the init method?

515


What is servlet and how it works?

506


What are the phases of a servlet life cycle?

617


What is servlet mapping?

596


What is the main purpose of java servlets?

583


How do you load an image in a Servlet?

656


Which interface must be implemented by all servlets?

791


What’s the difference between forward() and sendredirect() methods?

572