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 are different types of encoding?

1082


Which programming language is best in future?

968


What is final modifier?

1064


What about features of local inner class?

1070


Can you override a final method?

1039


What is the preferred size of a component in java programming?

1005


How are the elements of a gridbaglayout organized in java programming?

987


What are the benefits of immutable objects?

1013


What is t type java?

1070


when should you use stringbuilder class in a program?

991


What are the difference between string, string builder, and string buffer in java?

1131


How do you add spaces in java?

1015


What is the difference between static binding and dynamic binding?

1136


What does the “static” keyword mean?

1113


Is ruby built on java?

961