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
Is array serializable java?
What data type is a string?
How we can execute any code even before main method?
What is the function of static in java?
What is the major difference between linkedlist and arraylist?
What is the transient keyword?
Describe how to implement singleton design pattern in struts.
What is meant by collection in java?
what is singleton class in java?
What are constants and how to create constants in java?
Is void a data type?
What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?
What are the differences between forwarding () method and sendredirect() methods?
What are thread groups?
Can java list be null?