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 difference between interface and abstract class..?

Answer Posted / nipun advinder

Interface:
1)In interface you cannot provide any implementations of
any function.
2)you must give implementations for all the methods of an
interface if you implement it in a class
3)cannot have private method
4)Scenario to use it would be to separate out the
implementation from the api

Abstract Class:
1)In interface you can provide implementations of any
function but at least one function should be abstract.
2)you must give implementations for all the abstract
methods of a abstract class if you extend it in a class
3)can have private method
4)Scenario to use it would be to denote is as a generalized
class which could provide some common functionality and you
want that it cannot be instantiated instead more
specialized forms are used.

eg abstract class account
class savingsaccount extends account
class currentaccount extends account

In this scenario assume that class account cannot provide
the complete functionality alone but contain some standard
ones.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum size of byte array in java?

968


Explain the different forms of polymorphism?

958


why are there separate wait and sleep methods? : Java thread

979


Explain jdk, jre and jvm?

927


What is an arraylist in java?

1000


What is an exception? difference between Checked and Unchecked exception in Java

962


What is arrays fill in java?

955


Can we have two methods in a class with the same name?

996


What is the size of arraylist in java?

991


What is passed by reference and pass by value ?

992


Can list be null in java?

992


How garbage collection is done in java?

1000


Which method cannot be overridden in java?

956


How to calculate the length of a singly linked list in java?

970


Can It is possible to synchronize the constructor of a Java Class?

1047