Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

when to use abstract class and when to use interface?

Answer Posted / amit

Abstract provides both methods with and without body.
Adding new methods in abstract class in middle of
development life cycle won't break existing sub classes
unless these methods are declared as mustoverride. If there
are frequent addition of new methods properties and so on.
one should use abstract..

Whereas on the other hand interface can fill gap of
multiple inheritance. One can
implement from more than one interface. Not same with
Abstract. One can inherit
from only one abstract class.

Is This Answer Correct ?    44 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a top level class be private or protected?

997


How to change the priority of thread or how to set priority of thread?

979


What is the functionality of the stub?

969


Can a static class implement an interface?

1052


What happens if an exception is throws from an object's destructor?

986


What is an array in java?

1126


Explain exception chaining in java?

1086


Is null a string in java?

1006


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

905


What is meant by data hiding/encapsulation?

1043


Can an interface be defined inside a class?

1004


What is charat java?

906


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

936


What is the use of put method?

891


What is the purpose of default constructor?

956