Deepika Joshi wrote:static <T> void myMethod (T [] a Collection <T> c)
I am learning generics and I am not sure role of <T> next to 'static'...
Can you please write how to read it (static <T>), and what is use of <T>
Thanks....
Oh that is what i just studied [still i'm not perfect, but can give you a clue]
T stands for "type" & E stands for "element"
Now if you make a generic class than you will declare the type in the class itself as
but sometimes you don't need to make a generic class and you only need to make generic method, that is when you have to declare your method in such a way so that you can place the type element of class in your method:
declaration of generic method for the above code:
<T> must come before return type.
regards,
Rafi