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 / easwar
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.And more
over interface has only abstract methods. We need a sub
class to implement it.We cannot create an object for an
interface. So we cannot use only the classes or only the
interfaces in java.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the main functionality of the remote reference layer?
Explain how hashmap works?
What is the purpose of sizeof operator?
What are the 3 types of loops in java?
How many threads can I run java?
Which method returns the length of a string?
What sorting algorithm does javascript use?
What is constant in programming?
What is the use of callablestatement?
How do you detect memory leaks?
Is 0 true or false in java?
Can a final variable be null?
What is a marker interface?
What is hashmap in java?
What is meant by memory leak?