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 maximum size of array in java?
How many types of design patterns are there?
What is string intern in java?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
What is the full form of jpeg?
What is main in java?
Does importing a package imports its sub-packages as well in java?
What is the purpose of javac exe?
Explain garbage collection in java?
What is balanced tree in java?
How can we pass argument to a function by reference instead of pass by value?
Who is the owner of java?
What is a conditional statement explain with example?
Will the jvm load the package twice at runtime?
what is object slice?