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
What does math floor () do?
What is the difference between compile-time polymorphism and runtime polymorphism?
How large is a boolean?
Can we use different return types for methods when overridden?
What is the type of lambda expression?
What about main thread in java?
What is java basic concept?
Can arraylist contain null values?
What is unicode in java?
What is application system?
What are three advantages of using functions?
What are the differences between throw and throws?
Explain what is Marker interface?
What method is used to specify a container's layout in java programming?
What is the use of isempty in java?