This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
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: 30138
    
150

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
How To Call Two Different Classes From the Main Program Using the Same API?
interface extends interface ?
Home interface or Home Interface stub
Time Capsule
Writing an Interface