when to use abstract class and when to use interface?

Answer Posted / ravikiran

abstract class is used if you are willing to restrict the
creation of an instance.
interface is used if you are willing to write different
functionalities in different implementations.

Is This Answer Correct ?    34 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is udp in java?

765


What are examples of modifiers?

738


What are the three parts of a lambda expression?

764


What are different access specifiers in java?

770


How to check if a list is sorted in java?

810


What is difference between public static and void?

717


What is a copy constructor in java?

829


What is == mean?

764


What is field name?

789


What is locale?

830


How to do encapsulation in java?

837


State the difference between creating string as new () and literal.

747


What is final class?

801


Why parameters should be passed by reference?

722


How do you decide when to use arraylist and linkedlist?

762