my dog learned polymorphism*
The moose likes Beginning Java and the fly likes interfaces 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 "interfaces" Watch "interfaces" New topic
Author

interfaces

pt kris
Greenhorn

Joined: Aug 16, 2002
Posts: 2
hi all,
What if two interfaces have the same function declaration and I implement both these interfaces in the same class?
What will be the result of this??
Thank u...
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
krisp,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
What if two interfaces have the same function declaration and I implement both these interfaces in the same class?
What will be the result of this??

Nothing special. The class would have fulfilled it's promise to both interfaces - to implement a method with the required signature. If the interfaces were expecting different results from the implemented method, then you're likely to have a problem one day when a client using the class doesn't get the results promised by the interface's API.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: interfaces
 
Similar Threads
disadvantages of interfaces
interfaces
Bridge Design Pattern...
Advantages of Nesting Interfaces ?
What is the use of Marker interfaces?