How the interface is used without implements keyword in java

Hello Mosh,
its a great learning till now. Thanks for your efforts to make the tutorial clear for us.
In the second part of Java about Interfaces, the video is about interface segregation principal. There you have created a UIWidget interface with 3 abstract menthods. But how are able to access UiWidget interface in Dragger class? Atleast we need implement keyword or someother method which passes UIWidget object to Dragger class. But I am confused how it worked.
part : 2
topic: interfaces
Video No: 9
at 1:28 seconds. please refer to the screenshot attached.

Hi in this case, the dragger class is not implementing the interface, it just has its own drag method which takes a object of type “UIWidget”

If we wanted the class to follow the contract of the UIWidget interface we would use the “implements” keyword and then need to provide implementations for all the methods in UIWidget inside the Dragger class ie: drag(), resize() and render()

1 Like