Java – interface extends itself
•
Java
I have used this website for about 6 months, and it's time to ask my first question, because I can't find the answer, at least not an answer I can understand!
In this code, why does this interface extend?
public interface PositionedVertex<V extends PositionedVertex<V>> { /** * @return Position for node data. */ public Point getPosition(); }
Won't this code do the same?
public interface PositionedVertex<V> { /** * @return Position for node data. */ public Point getPosition(); }
Thank you in advance!
Solution
The interface is not extended< The V extension positionedvertex < V > is a generic type of binding associated with your interface This simply means that the generic type parameter of any class that implements this interface must be positionedvertex
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码