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

What is the difference between Abstract Class and Interface

Answer Posted / vikrant

Nothing stops you using interfaces and abstract classes
interchangeably. The difference is in the ideology where to
use it.

An abstract class is to be used when one needs to create a
hierarchy. e.g. Poodle, Pointer and Chihuahua are all breeds
breeds of dogs, they have some common characteristics as
dogs and some special characteristics of its breed. so all
breeds (Poodle, Pointer and Chihuahua classes) will inherit
from the Dog class.

Interface on the other hand is just a contract. The
implementing classes need not be related. Say a 3-D figure.
Sphere, Cone, Cylinder are all 3-D shapes they have nothing
in common apart from being 3-D figures. Each will have their
own equation for calculating area, perimeter, volume. All
need to specify in Shapes interface is that the implementing
class must be able to calculate area, perimeter, volume.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of methods are there?

1117


Are constructors methods?

1072


How many bytes is a unicode character?

1057


Are functions objects in java?

1123


What are mutable classes?

1126


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

1058


If you are given the name of the function at run time how will you invoke the function?

1186


Explain the difference between intermediate and terminal operations in java8?

1161


Where import statement is used in a java program?

1188


How do you call a reference in java?

1035


Why java applets are more useful for intranets as compared to internet?

1125


What is the difference between equals() and == in java?

1016


What does exclamation mean in java?

1176


Is class forname reflection?

1033


When can you say a graph to be a tree?

1132