what is difference between abstract and interface?
can i give real time example for the two topics?

Answer Posted / tharun raj s

an abstract class contains 1)instance variables 2)concrete
methods(implemented methods). 3)abstract
methods(unimplemented methods)
An interface contains 1)abstract methods and variables which
are public static and final by default

Abstract class is written when there are certain common
features shared by all the objects
Interface is written when all the features are implemented
differently in different objects

when an abstract class is written it is the duty of the
programmer to provide subclasses to it.
An interface is written when the programmer wants to leave
the implementation to the third party vendors

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you escape in java?

572


Explain about fail fast iterators in java?

556


What happens when you add a double value to a string?

538


What is java used for?

549


What are runtime exceptions?

607






What is multithreading in java?

543


What is a method signature java?

564


How to sort list of list in java?

653


Why you should not use singleton?

536


Can we inherit inner class?

519


What is constructor and its types?

535


Why main method is called first in java?

541


What is the collection interface?

582


Why 1 is not a prime number?

547


What is the disadvantage of java?

502