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


Please Help Members By Posting Answers For Below Questions

How do you square a number in java?

560


Is java hashset ordered?

582


State the difference between strings and arrays.

603


Explain about version control?

597


What do you mean by exception handling in Java?

662






Explain what access modifiers can be used for methods?

572


When should I use stringbuffer?

573


How many bits is size_t?

545


What is a line separator in java?

543


What is the default size of set in java?

504


Why does the integer quotient -0/3 yield 0, but the double quotient -0.0/3.0 yields – 0.0?

615


What do you understand by the term string pool?

570


How many types of the indexof method are there for strings?

493


How do I get the | symbol on my keyboard?

597


Can you use abstract and final both with a method?

573