Implimenting Interfaces

J

Java Buai

Hi all,

I am very new to Java programming, just learning in fact. Now doing
inheritance of classes and interfaces but need to know:

is it possible for an interface to impliment another interface.

I know a class can impliment any number of interfaces.

Thanks,
Java Buai
 
T

tom fredriksen

Java said:
is it possible for an interface to impliment another interface.

An interface is an abstract entity which only declares methods names, so
there can not be any "implements". Only classes can do that. An
interface can only be extended.

/tom
 
R

Roedy Green

An interface is an abstract entity which only declares methods names, so
there can not be any "implements". Only classes can do that. An
interface can only be extended.

see http://mindprod.com/jgloss/implement.html
http://mindprod.com/jgloss/extend.html

the terminology in Java is illogical in two respects. I discuss the
absurdities in those links. No wonder it makes no sense to you.

to add insult to injury they extend interfaces in generics. I think
at some point they may be declared equivalent, or you code either way
an and IDE cleans it up.

Perhaps some day either "extends" or "implements" will be deprecated.
Or you will be allowed to implement abstract classes and extend
interfaces with abstract classes. The compiler always knows what you
mean. It is mother-may-I game akin to venery hazing.

See http://mindprod.com/jgloss/venery.html
 
I

Ian Shef

Hi all,

I am very new to Java programming, just learning in fact. Now doing
inheritance of classes and interfaces but need to know:

is it possible for an interface to impliment another interface.
There is no implementation code in an interface, so it cannot IMPLEMENT
another interface. However, an interface can EXTEND one or more interfaces.

Examples can be found in the javadocs. For example,

in javax.swing.event.MouseInputListener

public interface MouseInputListenerextends MouseListener,
MouseMotionListener

and in java.awt.event MouseListener

public interface MouseListener extends EventListener

and at the head of the chain in java.util EventListener

public interface EventListener
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top