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


Please Help Members By Posting Answers For Below Questions

Which software is used for java programming?

560


What is the difference between a method and a procedure?

549


What exactly is java?

519


Can list be null in java?

579


What does index mean in java?

542






Can size_t be negative?

618


Is it possible to override the main method?

535


Why do we use bufferedreader?

542


What is preflight request?

532


What restrictions are placed on method overloading?

612


What is a buffer in computer?

515


What is the default access specifier for variables and methods of a class?

570


Which number is denoted by leading 0x or 0x in java?

564


How to add menushortcut to menu item?

566


Can you explain the private protected field modifier?

571