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

Is zero a positive integer?

1054


What is hashmap in java?

1052


What is map and hashmap in java?

1054


What does super keyword do?

1067


What is factor r?

957


What is the format specifier?

914


How is a variable stored in memory?

994


explain the concept of virtual method invocation in polymorphism in detail?

2213


What is array length in java?

953


Which methods are used during serialization and deserialization process?

983


What is the difference between length and length() method in java?

1094


Can one thread block the other thread?

1021


What is the static import?

1094


How to create com object in Java?

1064


What is core java used for?

1107