Sorry, could you explain your problem in detail?

jabber (jabber)
Let me do some quess work.

1) If both interface A and B have the same contents and their only difference is in their names, it means you don't need two two interfaces. If you really need two Java data types, you may have interface A hold all the methods, and interface not to contain any methods. (This is the co-called Marker Pattern).

2) If Interfaces A and B share some methods but B has more methods, you may have B extend A.

public interface A{
//some methods

public interface B extend A{
//some NEW methods

public class MyClass implements B {
//implement all the methods in A nd B
//Introduce new methods

In any case, I think it is agaist to the business rule to have two interfaces who have the same contents.
2000-11-2 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: If I have to implement two interface which have same function in one class, how can i do it?

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论