when,where and how to use abstract class and interface

Answer Posted / prapanch

if the developer wants some methods which are implemented
in the super class and some methods which will be
implementd by him then he will go for abstract class.
because in abstact class all methods need not to be abstact
in nature. but in interface all the methods must be
abstract and so the developer will not get any implemented
code from the interface. you will use interfaces when two
different teams are working for a same requirement then an
interface will act like a medium with which they can
interact and all the teams will be in line.so your team and
other team will implement the same method names but with
difffeerent implementation code.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

789


What are the ways to instantiate the class class?

812


What is sorting algorithm in java?

774


What is object-oriented programming?

803


What is the old name of java?

717


Which software is used for java programming?

780


Why are the objects immutable in java?

753


What is a singleton class in Java?

745


Why destructor is not used in java?

748


When should I use singleton pattern?

813


Where is the singleton class used?

787


How do you create immutable object in java?

795


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

770


Can final class have constructor?

710


enlist some features of jdk.

751