answersLogoWhite

0

Need of interface in java

User Avatar

Anonymous

12y ago
Updated: 8/20/2019

Interfaces are used in Java to accomplish most of the goals of Multiple Inheritance. For several reasons, Java only supports Single Inheritance for classes - i.e. a class can have only a single parent. The use of Interfaces is how Java attempts to implement most of the positives of the concept of Multiple Inheritance while avoiding its pitfalls.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Can you do java keylogger?

Yes, it is possible to write a keylogger in Java, but you would need to use the Java Native Interface to do so.


Can you define variables in interface in java?

yes we can define a variable in an interface in java.


Can you create a constructor for an interface in java?

NO, we cannot create a contructor for an interface in java.


What is intrface in java?

interface is a list of methods which implements that interface


What is a tagging interface type?

A tagging interface type in Java is an interface that has not defined methods such as the java.io.Serializable interface.


What java interface must be implemented by all threads?

Runnable interface


Can you create an empty interface with no definitions?

Yes. This is a valid interface definition in Java: interface Useless {}


What do mean by interface in java?

An interface in Java is like an abstract class, but there are no method bodies allowed in it and it has to be declared with the interface keyword. It is Java's way of getting around the Deadly Diamond of Death. Only abstract methods and constants are allowed in it.


What is interface in java?

Interface is collection of abstract methods which has only declaration and no implementation


What would interface java be used for?

Interface Java can be used for a variety of tasks and commands such as .swf files, Java files, running scripts, as well as website video players for websites.


Why you neet interface in java?

When you need the benefits of multiple inheritance while avoiding the DDD (Deadly Diamond of Death). Java doesn't allow multiple inheritance anyway.


Can you create an object of interface in java?

maybe