aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface" Watch "interface" New topic
Author

interface

Bharat Kothari
Greenhorn

Joined: Sep 09, 2007
Posts: 1
what is purpose of using interfaces rather than allowing multiple inheritance of classes as in C++??
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29247
    
139

Bharat,
Welcome to JavaRanch!

In C++, you can have two superclasses each containing a method with the same signature. When this happens, how does the subclass know which implementation to inherit? Java gets rid of this sticky situation by only allowing you to extend the implementation of one superclass hierarchy. You can use an interface for any other signatures/contracts you need. Since you supply the implementation, there are no conflicts in this case.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface
 
Similar Threads
interface extends interface ?
Writing an Interface
Time Capsule
How To Call Two Different Classes From the Main Program Using the Same API?
Home interface or Home Interface stub