Java "implement interface"?

I know that "implementation interface" means: the class implements the interface. Now I met a puzzle in Android Studio (in IntelliJ IDEA, there are similar doubts.): Pay attention to the following image: When Child implements the interface and overrides the fun2 method, there will be a certain icon on the left. But the parent interface does not implement the interface, why does the same icon appear?

tK4H1.png

More image here

+5
source share
1 answer

In the full version of IntelliJ with 3 examples that you posted above, the icon you are linking to has guidance text:

Implements a method in an interface through a subclass of Child

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

Why is he doing this? Well, if you remove the class definition fun1 from Child , then fun1 , of course, is visible in the Child class through inheritance from Parent , thereby fulfilling the requirement for implementing Interface .

+2
source

Source: https://habr.com/ru/post/1268071/


All Articles