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 main functionality of Prepared Statement?

4 Answers  


What is the destroy method?

0 Answers  


What is the final variable?

0 Answers  


Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example

0 Answers  


What is java lang string?

0 Answers  






Can we declare static variables in JSP page.

3 Answers   TCS,


what is mena by object block any what is the use of that

0 Answers   CGI,


What is inheritance?

5 Answers   Accenture, Hexaware, Syntel,


I have a Person object with 5 variables and I want to store them in a file called Person.txt. What should I do?

3 Answers   KPIT,


What is the unit of plancks constant?

0 Answers  


why String class is immutable.

5 Answers   iGate,


Why should we use java?

1 Answers   IBM,


Categories