File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interface

 
Suman Mummaneni
Ranch Hand
Posts: 89
Google App Engine Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a class implement multiple interfaces
 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes ,

[b]
A class can implements multiple interfaces .
A class can extends a single class .
A interface can extends multiple interfaces .
[b]

bye
 
javainthinking
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
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 ]
 
mohan gavande
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,

there is multiple implenents in java
but there is no multiple inheritance in java
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rajith Vidanaarachchi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bye.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic