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...

Thanks A.jyotsna,
Can u tell me differnce between abstract class and interface

vikash

Answer Posted / mohammad shoiab

Difference Between Abstract Classes and Interfaces
Abstraction - A way to provide a view to an object
In real life we have examples like resume,hotel menu,
trailer of a movie as examples for abstraction. They
provide an insight into the other object.
Abstract classes and Interfaces are implementation of
abstraction.
abstract class - when u want to create classification or
hierarchy of classes, u can use inheritance and generally
your parent classes would like to impose certain compulsory
behavior along with some free behaviours. in such a case
the compulsory behavior to be declared as abstract, there
by the class should also be declared as abstract, so the
right place for abstract class is only in the case of
inheritance.
Interface - Interface are more related to roles, like for
example, u r a kind of human, and u r playing the role of a
programmer, here human could be a abstract parent class
and programmer could be a interface.
In real life all roles carry compulsory behaviors and if
you want to get into some role, then it is compulsory to
implement all the methods of the role.
"The world is a stage, every one is a actor, every actor
carries a mask, and when the mask changes the role changes,
and when the role changes the behaviour changes"
The roles are interfaces - u know very well one person can
carry many roles, so one class can carry many interfaces
but it can belong to only one classification. Thats why
multiple inheritance is allowed for interfaces and not
allowed for abstract or concrete classes,

Happy!!! - want to know more fundas - contact me -
Shoiab - 9840135749 - Haaris Infotech - The Java Trainers -
Chennai

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is numeric data type?

927


What is a double vs float?

944


What is java console application?

943


How to change value in arraylist java?

1096


How hashmap increases its size in java?

932


What is object class in java?

868


How to print nodes of a Binary tree?

2199


What is the difference between ArrayList and Vector? which one is better in Java

1078


How do you define a singleton class?

1009


What are byte codes?

1133


How do I find and replace in word?

919


What is the basic difference between string and stringbuffer object?

1024


What are the advantages and disadvantages of reference counting in garbage collection?

971


What is sizeof () operator?

925


What is anagram of a string?

887