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 meaning of course?
What is the benefit of inner / nested classes ?
What is the difference between class forname and new?
What is the use of singleton?
What is hotjava?
Is Java a dying language?
What is the difference between import java.util.date and java .util?
In a container there are 5 components. I want to display all the component names, how will you do that?
Say any two properties in beans?
Can you access the private method from outside the class?
Are registers volatile?
What is the main method java?
What is size_t?
Can inner class final?
What is the size of an array?