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
Are constructors methods?
What are the super most classes for all the streams?
What is jvm? How its run?
Why is stringbuffer thread safe?
How can constructor chaining be done using this keyword?
How is tree Mirroring implemented?
What is the difference between an inner class and a sub-class?
Name four container classes.
What are the types of web technologies?
Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
Why we cannot override static method?
What is the difference between iterator and enumeration ?
what are the states associated in the thread? : Java thread
Define immutable object?
Can we able to pass objects as an arguments in java?