I have to work with an API that is accompanied by a few examples. In one of the example, an interface is being directly used to call one of the methods of that interface. However, since Interface do not contain any implementation, I would like to know: How can the methods be used in the example to accomplish anything without defining a class that implements that interface?
Or, can the interface contain complete method definition too? (which seems to be the case here)
No, the interface contains only method signatures. You cannot have an implementation in an interface.
What is (most likely) happening in your case is something like (pseudocode):
Calling method: