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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is jit and its use?

575


What is arraylist e in java?

502


What are the two environment variables that must be set in order to run any java programs?

521


What is the history of java?

538


What is polymorphism and what are the types of it?

494






How does thread synchronization occurs inside a monitor?

542


Can we declare a class as abstract without having any abstract method?

547


Can a constructor call the constructor of parent class?

529


What is a classloader in java?

531


What do you mean by jjs in java8?

552


What is the size of a string in java?

538


What is meant by class loader? How many types are there? When will we use them?

497


What is flag in java?

527


What is java algorithm?

518


Explain the difference between abstraction and encapsulation.

535