permaculture playing cards
The moose likes Beginning Java and the fly likes Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interface" Watch "Interface" New topic


Suman Mummaneni
Ranch Hand

Joined: Dec 14, 2004
Posts: 89

can a class implement multiple interfaces

Suman Mummaneni
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Yes ,

A class can implements multiple interfaces .
A class can extends a single class .
A interface can extends multiple interfaces .


Joined: Dec 01, 2004
Posts: 4
It's must follow the format below:
class implements class1,class2,...class n [extens classA](optional).

But you can't write like this below:
class extens classA,classB,classC.....

[ December 16, 2004: Message edited by: javainthinking ]

Good good study! <br />Day day up!<br />——————javainthinking
mohan gavande
Ranch Hand

Joined: Oct 07, 2004
Posts: 39

there is multiple implenents in java
but there is no multiple inheritance in java
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
It's kind of interesting what happens if two interfaces have identical signatures, say "public void someMethod( String arg )". When you implement it once you've made both interfaces happy. But you can't tell which interface the caller had in mind when they made the call. Unless the two interfaces promise very similar behavior you run the risk of confusing the caller.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Rajith Vidanaarachchi

Joined: Nov 06, 2004
Posts: 11
Hello All,
My answer is Yep.
A class can extend only one class but can implement multiple interfaces. And an interface can extend multiple interfaces.
I agree. Here's the link:
subject: Interface
It's not a secret anymore!