5

I know "implement interface" means: A class implement a interface. Now I met a puzzle in Android Studio (In IntelliJ IDEA, there has a similar doubts.): Note the following picture: When Child implement the Interface, and override the method fun2, there will be a specific icon on the left.But the Parent don't implement the Interface, why an same icon appear?

Bigger picture here

4
  • 1
    Never link to external sites. Always put up all relevant code here. Commented May 21, 2017 at 15:50
  • @GhostCat OP asked specifically about the icons and he has to put a picture of it. He doesn't have the rep to upload a picture therefore he had to link to an external site. Commented May 21, 2017 at 15:58
  • This question is about IDE,if not link to external sites show the screenshot, no one will know what the problem is。If you have time, please review the question. Commented May 21, 2017 at 16:00
  • If you hover your mouse cursor over the icon, what does the tool tip that appears say? Commented May 21, 2017 at 19:40

1 Answer 1

2

In the full version of IntelliJ with the 3 example classes you posted above, the icon you refer to has hover text:

Implements method in Interface via sub-class Child

In other words IntelliJ is smart enough to see the association between the interface and the inheritance structure.

Why does it do this? Well if you remove the definition of fun1 from Child class, then fun1 is of course visible in Child class via inheritance from Parent, thereby fulfilling the requirement to implement Interface.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.