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 / shaik baji

Interface in the sence a generic templet that means it will
define a generic functionalities of a group.
For Ex:- We can say "Car" as an interface

1)let's asume if you want a List interface functionalities
the your class should implements the List interface, that
means you should implement all the methods which are
available in List interface even you are not using all the
methods so that the Java developers designed the classes
which are implements the java.util interfaces.

Now if you want any interface functionalities then you just
create an object of that related java.utill package class
and call the methods by using the object.

2)Java doesn't support multiple inheritance.We achieve
multiple inheritance using interface concept.A class can
have only one super class and number of interface.

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is exception in java?

573


Can we initialize the final blank variable?

588


What is the use of static class?

549


How do I remove a character from a string in java?

506


What is meant by class and object in java?

559






What is the difference between stringbuffer and stringbuilder?

577


We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.

1494


Tell me about your ability to work under pressure

1772


What is java util concurrentmodificationexception?

504


Can singleton class be cloned?

565


Explain public static void main(string args[]) in java.

537


Explain the significance of class loaders in bootstrap?

503


Can we declare an interface as final?

578


What is lifetime variable?

527


What is map java?

521