when,where and how to use abstract class and interface

Answers were Sorted based on User's Feedback



when,where and how to use abstract class and interface..

Answer / 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

when,where and how to use abstract class and interface..

Answer / vinaykumar

If you want to provide your own services for methods we
use interfaces.If you want to provide your own services or
to use the services of the methods in your class then wego
for abstract classes.abstract class is partially implemented
and partially unimplemented class where as interface is
completely unimplemented.both of the objects can not be
created.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

what questions are been asked ??? for interview in apti

0 Answers  


give an example for encapsulation?

0 Answers   Aspire,


How can constructor chaining be done by using the super keyword?

0 Answers  


What is meant by class loader and how many types are there?

2 Answers   Apple,


What is difference between array and arraylist in java?

0 Answers  


What are init(), start() methods and whey they are called?

2 Answers  


What are the 4 types of research methods?

0 Answers  


What is the reason that multiple inheritance is not possible in java??

1 Answers  


What is difference between null and void?

0 Answers  


What is data member in java?

0 Answers  


What do you mean by order of precedence and associativity?

0 Answers  


In C we use only compiler. Why java uses both compiler and interpreter? What is its significance?

5 Answers  


Categories