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 we r go to abstract class and when we go to Interface?
i have confusion this question while in interview plz clarify

Answer Posted / nani

If we want share some common features with all we can go for
abstract otherwise we can prefer interface .
i will give good example to understand easily.
Ex: wholesaler has books and stationary(pens & papers)

supplier1 ask for X class books and Pens
Supplier2 ask for X class books and papers.

here both suppliers asking same standard books and different
stationary items.suppose we can take it as by methods, here
here books methods are common to shared by both suppliers.so
book method is non abstract class. so here we can prefer
abstract.



supplier1 ask for X class books and Pens
Supplier2 ask for V class books and papers.

here both suppliers asking different standard books and
different stationary items.

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 null object in java?

957


What is a buffer in java?

970


Which access specifier can be used with class ?

943


What is the maximum size of a string in java?

1001


What is a bufferedreader?

997


Do I need to import java.lang package any time? Why?

1309


Where pragma is used?

990


What is the finalize method do?

1044


How do you check if a number is a perfect square?

934


How many types of threads are there in java?

992


Is linkedlist thread safe in java?

940


What is data movement?

1063


Why local variables are stored in stack?

919


What is treeset in java?

940


What methodology can be employed to locate substrings inside a string?

901