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

What is the main functionality of the remote reference layer?

1647


Explain how hashmap works?

799


What is the purpose of sizeof operator?

745


What are the 3 types of loops in java?

721


How many threads can I run java?

785


Which method returns the length of a string?

783


What sorting algorithm does javascript use?

750


What is constant in programming?

761


What is the use of callablestatement?

773


How do you detect memory leaks?

773


Is 0 true or false in java?

740


Can a final variable be null?

751


What is a marker interface?

816


What is hashmap in java?

813


What is meant by memory leak?

728