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 are the advantages of functions?

714


When arithmeticexception is thrown?

799


Why are parameters used in functions?

719


What is javac in java?

760


What is the use of inner class?

761


What is thread safe java?

697


Is double bigger than float?

747


What is the difference between equals() and == in java?

710


What is arraylist e in java?

731


Differentiate between postfix and prefix operators in java.

877


What is the maximum size of a string in java?

755


What is __ init __ functions?

796


Define the term string pool?

789


What is a wrapper method?

761


What is the difference between a static and a non-static inner class in java programming?

730