Java – interface extends itself

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
分享
二维码
< <上一篇
下一篇>>