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

What is singletonlist in java?

716


Explain naming conventions for packages?

778


What are invisible components?.

1901


What will happen to the exception object after exception handling?

797


Can constructor be protected in java?

731


Can a class be a super class and a sub-class at the same time? Give example.

1160


What is an object’s lock and which object’s have locks?

697


Can we use static class instead of singleton?

827


What is the purpose of the file class in java programming?

755


What is an inner class in java?

722


What is the difference between call by reference and call by pointer?

729


What is string literal in java?

788


What things should be kept in mind while creating your own exceptions in java?

861


What do you mean by boolean?

828


Can we create an object of private class?

747