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 a protected void?
What are the disadvantages of using inner classes?
How can we find the sum of two linked lists using stack in java?
what is recursion in java
What is communist flag?
Is set sorted in java?
What are the advantages of packages in java?
How do I write a self declaration?
What is == mean?
I am a fresher and know core java, c languge, html, css etc if I am illegible for any job then send it on my email tatranakshay276@gmail.com
What is the functionability stubs and skeletons?
Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example
Difference between current previous versions of Java?
Why volatile is used in java?
How do you achieve polymorphism in java?