Generic method confusion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Generic method confusion

Why is generic type mentioned twice here using dimond operator on a method? Thanks static <T> InterfaceName <T> var(){}

7th Mar 2021, 11:03 PM
Nobody
Nobody - avatar
1 Answer
+ 1
1. Indicate the language! 2. Are you sure that is correct? It doesn't look right at first glance to me. 3. One is for the generic return type (returns a value of the generic) another for the generic method signature itself.
8th Mar 2021, 12:36 AM
ChaoticDawg
ChaoticDawg - avatar