Java- Interface makes use of an interface -


i'm studying code. 've found these 2 classes. don't understand how related. expression "t extends piecetype" mean, t stand for?

piece.java:

public interface piece<t extends piecetype> {      /**      * returns color.      * @return color      */     piececolor getcolor();          /**      * returns type.      * @return type      */     t gettype(); } 

piecetype.java:

public interface piecetype {      /**      * returns type's base rating.      * @return base rating within range [0, 1000]      */     double getrating(); } 

as mentioned, means type, t, pass piece must extend piecetype.

here have interface extends piecetype:

public interface newpiece extends piecetype {     ... } 

you instantiate piece object doing this:

piece<newpiece> apiece = new someimplementationofpiece<newpiece>(); 

because newpiece extends piecetype given in definition:

public interface piece<t extends piecetype> { ... } 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -