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

Discuss different types of errors that generally occur while programming.

0 Answers   Amdocs,


What is threaded programming and when is it used? : Java thread

0 Answers  


Explain java coding standards for classes or java coding conventions for classes?

0 Answers  


we know that every java prog must follows OOPS Principles. Anybody can answer, HOW THE FOLLOWING PROGRAM FOLLOWS OOPS CONCEPTS i.e, Inheritance,Polymarphism,Encapsulation? class a{ public static void main(String args[]){ System.out.println("Hello World"); } }

3 Answers  


What is arguments in java?

0 Answers  


What are the methods available in a class?

0 Answers  


Explain about static imports in java?

0 Answers  


Is &&= a valid Java operator?

2 Answers  


What is getclass () getname () in java?

0 Answers  


Explain treeset?

0 Answers  


How do you check if an arraylist is not empty?

0 Answers  


What is string in java?

0 Answers  


Categories