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

Differentiate between array list and vector in java.

897


What is a type parameter in java?

785


What is ph and buffers?

762


Can inner class extend any class?

828


Can an interface extend a class?

766


What are the important features of Java 11 release?

815


What is a protected method?

885


Can we extend singleton class?

743


What do the thread?class methods run() and start() do?

806


why java uses class level type casting ?

2462


Can we print null in java?

809


What is not thread safe?

777


What is unicode used for?

853


If a class is declared without any access modifiers, where can the class be accessed?

835


How many ways can we create the string object?

808