Answer Posted / rahul
The most important technical distinction between creating a
derived class and implementing an interface is that a
derived class can only inherit from one base class, but a
class can implement any number of interfaces.
From a design standpoint, think of inheritance as expressing
a specialization hierarchy. If WebSalesOrder "is a" special
kind of SalesOrder, you might consider making it a derived
class.
However, you need to be very careful that you don't use
inheritance when the specialization that distinguishes a
derived class from a base class is a feature that other
classes will also need to support. For adding those kinds of
features or capabilities to a class, implementing interfaces
will give you much greater flexibility.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How a component can be placed on Windows?
What are the different types of exception?
Why use POJO when I can use hashmap
What’s jboss jbpm?
Do you think that java should have had pointers?
To what value is a variable of the string type automatically initialized?
What is a modular application?
When a thread blocks on i/o, what state does it enter?
How are the elements of a cardlayout organized?
What is the difference between system.out ,system.err and system.in?
Have you used threads in Servelet?
What is RMI and what are the services in RMI?
How task's priority is used in scheduling?
What is metaspace?
If your ui seems to freeze periodically, what might be a likely reason?