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
Can inner class be public in java?
What is hashset in java?
What is return in java?
What is the difference between super class & sub class?
What is sizeof () operator?
What is r in java?
What is meant by data hiding/encapsulation?
What is an object in java and how is it created?
What value is a variable of the string type automatically initialized?
What is replacefirst in java?
What ide should I use for java?
Where and how can you use a private constructor?
What are the Static and Dynamic Variables? Differentiate them.
What is serialversionuid?
Explain different forms of polymorphism?