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

The purpose of interface is to have abstract methods and
the class which implemnts the interface has to define the
methods in the interface.
The reason why java collections have both interfaces and
classes is interface will have common methods which will be
needed by one or many classes. The classes which wants to
behave like this interface will implement this interface
and define methods in the interface.

Is This Answer Correct ?    14 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ternary operator? Give an example.

1018


What are different ways of object creation in java ?

1017


Write a program to reverse a number in java?

1039


What are meta-annotations?

932


Can a serialized object be transferred via network?

895


Explain the use of shift operator in java. Can you give some examples?

913


What is the properties class?

1030


Can we catch more than one exception in single catch block?

992


What is Classloader in Java?

1129


Which sorting is best in java?

957


can any body body expalin best definitions & best real time exaples for opps concepts.

2214


What is difference between == and === in js?

959


How to declare objects of a class ?

1015


What is java virtual machine? Explain

965


How do you reverse sort in java?

896