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 is regex used for?

0 Answers  


How you can force the garbage collection?

0 Answers  


AWT event listeners extends what interface?

1 Answers  


what is the difference between pagecontext and servletcontext?

5 Answers   JBA Infotech, TCS,


How do you insert a line break?

0 Answers  






Is main a keyword in java?

0 Answers  


java program with complete 4 oops concepts implemented example

0 Answers   Infosys, NIIT,


What is Java Classloader?

1 Answers   Phantom Technologies,


How to access a variable if it is declared as private?

3 Answers  


Different types of modifiers?

8 Answers   RoboCom,


What are the types of statement? explain

1 Answers   SysBiz,


What is java developer skills?

0 Answers  


Categories