When we will use an Interface and Abstract class?

Answer Posted / debapriya patra

Interface:
Through interface we get the multiple inheritance
in java.And we implement interfaces to override the
abstract methods it contains.


Abstract class:

We also use abstract classes to override the
abstract methods that it contains.Otherwise the child class
will mentioned as abstract.

If we wants to prevent a class from instantiation then we
mentioned it as abstract.

Is This Answer Correct ?    25 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

798


What does string mean in java?

839


What is anti pattern in programming?

746


What is the difference between import java.util.date and java .util?

819


Does java allow overriding static methods ?

846


What is Recursion Function?

895


How to sort a collection of custom Objects in Java?

837


Is integer immutable in java?

754


Difference between concurrent hashmap and hashtable and collections

816


Can we sort arraylist in java?

793


What is Applet Stub Interface ?

2182


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

782


Explain the features of interfaces in java?

761


How do you remove spaces in java?

776


What makes a function well defined?

782