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 static in java?
How does list work in java?
What are class members by default?
How will you compute size of a structure?
List primitive java types?
What is an argument java?
Which is bigger float or double java?
What is java lang object?
What is difference between module and function?
Will minecraft java be discontinued?
Which is better list or arraylist in java?
Are floats faster than doubles?
What is keyset in java?
What is the impact of declaring a method as final?
How we create object in copy constructor?