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

What is a functional interface?

539


Tell us something about different types of casting?

512


What is the difference between super class & sub class?

560


What is outofmemoryerror in java?

557


Differentiate between run time error and syntax error.

562






What is jvm? How its run?

650


What is the purpose of stub and skeleton?

536


What are the two types of exceptions in java? Which are the differences between them?

503


What is method reference in java?

551


How do you reverse a word in java?

524


What about instanceof operator in java?

593


How many unicode characters are there?

546


If a class is declared without any access modifiers, where may the class be accessed in java programming?

649


What is main difference between variable and constant?

517


What is the purpose of file class?

539