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 purpose of the main method?
What do you mean by Function Overloading in java?
What is the exception hierarchy in java?
Is it possible to override private or static method in java?
What means public static?
Which is the best sorting technique in java?
Can a main method be declared final?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
Can we overload the methods by making them static?
Can finally block be used without a catch?
What is object of class in java?
Can a class have an interface?
Can we declare array without size in java?
How do you remove duplicates in java?
Is node a data type in java?