What are the design considerations while making a choice between using interface and abstract class?



What are the design considerations while making a choice between using interface and abstract class?..

Answer / Rakesh Kumar Gupta

When choosing between an interface and an abstract class, consider the following factors:
1. Interfaces promote programming to interfaces rather than implementation classes, making it easier to change or reuse code.
2. Abstract classes can have instance variables and default implementations for methods, whereas interfaces cannot.
3. Interfaces are less verbose but more flexible, while abstract classes offer a compromise between flexibility and complexity.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Advanced Java Interview Questions

What is synchronization and why is it important?

1 Answers  


wahts is mean by dynavalidatorform in struts/

1 Answers   SolutionNET,


What are the types of data passing mechanisams under JMS specification?

1 Answers  


What is the difference between a menuitem and a checkboxmenuitem?

1 Answers  


What method is invoked to cause an object to begin executing as a separate thread?

1 Answers  


What do you know about seam?

1 Answers  


What are various types of class loaders used by jvm?

1 Answers  


what is an isolation level?

1 Answers  


In a multitiered application which tier is the browser in?

3 Answers   Adobe,


What is message driven beam?

1 Answers  


How many ways can a thread be used?

4 Answers   Sun Microsystems,


What is a clone?

1 Answers  


Categories