when to use abstract class and when to use interface?

Answer Posted / mohit jethva

In Interfate you are restricting a user to impement each
and every method of interface so if you have a requirement
which is constantly changing so don't prefere interface.

While in Abstract Class user don't need to implement each
and every method which is not required or marked with
mustoverride.


And by using interface you can achive multiple inheritance
in C# but with Abstact class it's can't be achive

Is This Answer Correct ?    31 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best way to findout the time/memory consuming process?

556


Explain the JDB in depth & command line.

565


Describe how to implement singleton design pattern in struts.

529


What are latest features introduced with java 8?

586


What is stack example?

541






Which variables are stored in heap?

541


what is abstract class in Java?

652


Can you run java program without main method?

543


What is the impact of declaring a method as final?

558


Do I need java for windows 10?

547


What are the two types of java?

515


What is boolean logic?

559


What is vector capacity in java?

595


How many bits is a float?

539


How to use string tokenizer class.

618