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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are static initalizers in java ?

571


What is linked hashset and its features?

541


What is the difference between static method and instance method in Java?

560


What is the difference between static binding and dynamic binding?

555


What is hashmap and map?

545






Which class is the superclass for all the classes?

527


How would you use Bubble Sort to sort the number of elements?

574


Can we override the static method?

572


What are the loops in java?

515


What are the difference between string, string builder, and string buffer in java?

544


What is an object's lock and which object's have locks in java programming?

561


Is jdk required on each machine to run a java program?

737


What is math floor in java?

470


What is number data type in java?

546


What is the purpose of java?

552