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 / vanaja
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 ? | 19 Yes | 1 No |
Post New Answer View All Answers
What is the significance of listiterator?
Can I overload to string method
Can an interface implement another interface?
What is the difference between quicksort & mergesort? When should they be used? What is their running time?
What is yield () in java?
What’s meant by anonymous class?
How to find the given number is a prime number or not by getting input from the user
When is finally block not called?
Why are pointers not secure?
How to display names of all components in a Container?
What is a boolean flag in java?
How do you declare a string variable?
What is a return in java?
Differentiate storage classes on the basis of their scope?
What is finalize() function in java?