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

Can list contain null in java?

627


What about interrupt() method of thread class ?

587


Print Vertical traversal of a Binary Tree.

611


Why is stringbuffer thread safe?

568


What is a list in java?

508






Explain about features of local inner class?

603


What is meant by object oriented programming – oop?

545


What is a two-pass assembler?

611


How do you do exponents in java?

538


what is the difference between a threads start() and run() methods? : Java thread

528


Can we assign the reference to this variable?

548


What is the covariant return type?

580


What is an example of character?

554


explain the concept of virtual method invocation in polymorphism in detail?

1719


Explain inheritance in java?

555