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

What are facelets templates?

599


What is hash code collision?

593


How do you generate random numbers in java?

520


What is anti pattern in java?

519


What is the difference between yielding and sleeping in java programming?

586






How can you set the applet size?

579


How is treeset implemented in java?

494


Is java platform independent?

570


What is increment in java?

526


Why is a string immutable?

546


Mention the default values of all the elements of an array defined as an instance variable.

523


Why is multithreading important?

495


What is difference between variable declaration and definition?

515


List some oops concepts in java?

584


What is get () in java?

568