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

Which method returns the length of a string?

0 Answers  


What is the arguement of main method?

1 Answers  


What is ternary operator in java?

0 Answers  


how to print a numbers from 1 to 100 with out using control structures?

4 Answers   IBM,


Can a for statement loop indefinitely?

3 Answers  


Can we declare an anonymous class as both extending a class and implementing an interface?

8 Answers   College School Exams Tests, JVA, TCS, Wipro,


What are the advantages of java over cpp?

0 Answers  


Define inheritance with reference to java.

0 Answers  


How do you stop a thread in java?

0 Answers  


please tell me what is wrapper class in java with example ?

6 Answers   HP,


What is a class object?

0 Answers  


what is mean by thread lock?

2 Answers   Infosys, TCS,


Categories