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 / rod

the bowlingball example I put is when you combine the
abstract class ball with the interface bowlable .. a poor
example perhaps.. lets replace that with

a sock may implement a washable interface which can also be
implemented by cars, shirts, dishes... etc.. so why bother
with this. The reason is for future use as the system grows.
It is more likely that you will run into an object that
needs to be 'washed' then you can in fact call this method
without knowing the lower level details.

its more than just organising things that do or are acted
upon by the same conceptual action. It means that later you
can just use the method because the interface populates the
list of things you can choose from at code completion in the
editor ..for example.

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does s mean in regex?

1068


Can Exception handling we can handle multiple catch blocks?

1086


Why is an interface be able to extend more than one interface but a class can’t extend more than one class?

1218


What is meant by local variable and instance variable?

1053


What is the same as procedures?

1037


Why we use methods in java?

1047


What is void data type?

1055


Explain when noclassdeffounderror will be raised ?

1095


How are variables stored?

1032


Explain the difference between comparator and comparable in java?

1027


How will you communicate between two applets?

1214


What are the basic control structures?

1035


What is the simpletimezone class in java programming?

1167


What is OOP Language?

1120


Is there a sort function in java?

1019