Reflections on the Java language (1) Interface

Original Address: https://www.cnblogs.com/huanghezhao/p/11257455.html

Question: If there are two interfaces, they just declare a method with the same name, and the two methods of the same parameters , but returns a different type . How to write a class, while achieving both interfaces?

A: I can not achieve. This article [1] has been given proved, not tired described.

C # a good solution to this problem. C # allows a class implementing the interface, which method explicitly which interface is implemented labeled [2].

Reference material

  1. https://www.geeksforgeeks.org/two-interfaces-methods-signature-different-return-types/
  2. https://www.geeksforgeeks.org/c-sharp-how-to-implement-multiple-interfaces-having-same-method-name/

Guess you like

Origin www.cnblogs.com/huanghezhao/p/11257455.html