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 an immutable object?
What is hashmap in java?
What is private static class in java?
Which language is java?
Add a value x to array from index l to r where 0 <= l <= r <= n-1
Does isempty check for null?
What is the epoch date?
What is a nested structure?
Which package is used for pattern matching with regular expressions?
How we can run a jar file through command prompt in java?
What is a flag and how does it work?
Is java still necessary?
How do you convert boolean to boolean?
How do you sort a string in java?
What is arguments in java?