What does > mean in Java?

后端 未结 2 1210
感动是毒
感动是毒 2021-02-10 09:44

I\'m creating an interface of JOOQ TableRecord

> 

Would anyone be able to explain the line above?

2条回答
  •  隐瞒了意图╮
    2021-02-10 10:25

    It means a class of type R, that implements the interface TableRecord

    TableRecord means that the interface is bound to the same type R.

    An example would be a class like:

    public class Bla implements TableRecord
    

    I admit this seems a bit strange, but Java generics don't really differentiate between extends and implements, which leads to some confusion.

    As to why this exact definition, I don't know enough about the context to see exactly why it makes sense, but it might be due to method signatures on the interface returning objects of type R (think Factory):

    public R createTableRecord(...);
    

提交回复
热议问题