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

IN java collections we have both interfaces and classes.
instead of using interfaces why we can't use classes only
like that why we can't use interfaces only. why we need two
things interface and class.

Answer Posted / sarath

Both of them have different purpose.
A Class have state(Fields) and behaviour(Methods). But in Interface we are telling a common behaviour.
for example I have a class called ABCBycycle.java . It implements some common behaviour of bycyle from Bycycle interface,
by implementing the Bycycle interface we are telling that ABCBycycle.java have some common behaviour of bycyle.
So iterface not the blue print of state and behaviour.
But Class is the blue print of some state and behaviour

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by java virtual machine?

1236


Can we modify the throws clause of the superclass method while overriding it in the subclass?

1075


can I implement my own start() method? : Java thread

1036


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

1077


what is bmg file and how to create that files?what will it contailn?

2396


What is an empty string in css?

1097


What is string intern in java?

1086


Explain about complier design(phases)

1132


Why java is object oriented?

1078


How variables are declared?

1028


What is a two-pass assembler?

1098


what are the states associated in the thread? : Java thread

1108


How is Object Oriented Programming different from Procedure Oriented Programming?

1087


What does 3 dots mean in java?

1033


What is meant by class loader? How many types are there?

1323