When should I use abstract classes and when should I use
interfaces?

Answers were Sorted based on User's Feedback



When should I use abstract classes and when should I use interfaces?..

Answer / ved.b.tripathi

Interface : when you about to maintain the standard through
out the application then,blindly go with the interface.

Abstract : when you customize the behavior but still want to
maintain some standard then use abstract,because in abstract
you can have non abstract method that will be use by every
class that extend this abstract method and that class also
have to give the body of abstract methods(standard).

Is This Answer Correct ?    15 Yes 2 No

When should I use abstract classes and when should I use interfaces?..

Answer / ankit

if u r required more than 1 class in ur prog then use
interface because u cant extends 2 class in ur prog ...to
use 2 class in ur prog u can implement 1 interface and
extends 1 class

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is the difference between the size and capacity of a vector?

0 Answers  


How many bytes are a float?

0 Answers  


Java openings 3 - 5 years, Lnt Infotech. requirements - core java, J2ee, struts, hibernate Interview Date:- 19 March 2011 Time:- 9:00 AM to 12:00 Pm Interview Location - L & T Infotech, Manapakkam, Chennai Refererral PS NO:- 291649 (Please mention this when u fill the form only then u will be considered for interview) Documents Required:- Latest Resume, Photograph and last 3 payslips Mail me on vasan2211@gmail.com once u appear for interview

0 Answers   L&T,


How is Object Oriented Programming different from Procedure Oriented Programming?

0 Answers   Amdocs,


How to handle a web browser resize operation?

0 Answers  






What are the approaches that you will follow for making a program very efficient?

0 Answers  


What is variable and example?

0 Answers  


What is a stringbuilder?

0 Answers  


What are inner and anonymous class?

3 Answers  


Explain the difference between private, public, package and protected in java?

0 Answers  


Explain polymorphism citing an example.

0 Answers   Amazon,


What is the purpose of the main method?

0 Answers  


Categories