I am new to the java.
I have a doubt regarding interfaces. In java you cannot create objects of interfaces as they are represent abstract structure which needs to be implemented by other classes.
If any class wants to implement an interface it has to explicitly mention implements keyword.
But I do not think same is true with anonymous inner classes.
Suppose I have an interface like
And here is my Test class. No where it mentions that it implements HelloInterface.
My doubt is inside getHello method we return an instance of HelloInterface interface as it is appended with new operatror.
How can we create object of HelloInterface as it is an interface?Also we have not mentioned that the inner class is implementing HelloInterface?
When I tried printing hello reference,it showed that the reference points to an object of Test type. How come hello is of type Test as it was created using new HelloInterface() ?