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
Is integer a class?
What is singleton service?
Define array. Tell me about 2-D array.
What is starvation?
What is sizeof () operator?
What are the types of strings?
What does a za z0 9 mean?
What is equlas() and hashcode() contract in java? Where does it used?
What is assembly condition codes?
How will you initialize an Applet?
What is double in java?
What is a local block?
Is arraylist an object in java?
What is matcher in java?
How does finally block differ from finalize() method?