What's this generics usage in Java? X.method()

前端 未结 5 568
野性不改
野性不改 2021-02-07 06:22

I\'ve read the whole SCJP6 book Sierra and Bates book, scored 88% the exam.

But still, i never heard of how this kind of code works as it\'s not explained in the generic

5条回答
  •  孤城傲影
    2021-02-07 06:47

    You are 100% correct, it is to help with type inference. Most of the time you don't need to do this in Java, as it can infer the type (even from the left hand side of an assignment, which is quite cool). This syntax is covered in the generics tutorial on the Java website.

提交回复
热议问题