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?where we can use it in realtime projects?

Answer Posted / vinod

We use Abstract class and interface to enforce some rules to the classes which extends/implements. For example we can define a class say "Bird" and we can declare methods say "Fly()", "Walk()". This means whatever the class that is derived from Bird has to override or give definition for Fly() and Walk() and therefore we are making sure that all the derived classes follows or has the common functionalities. In other way the classes derived from superclass should have common properties. In addition to this the derive class can have its own methods like "Swim()"...

In case of Abstract class we can define COMMON functionalities in super class and those can be used in the derived class where as in Interface we cant do that. ( this i would say as advantage of abstract class)

In case of Interface the derived class can implement any number of interface but restricted to extend only one abstract class (this i would say as advantage of Interface)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain inheritance in java?

974


What is the program development process?

964


What is the purpose of the wait(), notify(), and notifyall() methods in java programming?

1068


Is java call by reference?

960


What is communist flag?

1009


How does multithreading take place on a computer with a single cpu in java programming?

1006


What is the difference between break and continue statements?

1029


What is outofmemoryerror in java?

1017


A person says that he compiled a java class successfully without even having a main method in it? Is it possible?

1046


Why is it called buffering?

1110


What is the difference between actual and formal parameters?

937


What is the difference between jdk, jre, and jvm?

1101


What is the difference between the file and randomaccessfile classes?

1089


Can main() method in java can return any data?

1172


Explain public static void main(string args[]) in java.

978