How can you declare a generic type on a static method? - Cracking the Java Coding Interview

preview_player
Показать описание
Cracking the #Java #Coding #Interview - Question 80: How can you declare a generic type on a static method?
Рекомендации по теме
Комментарии
Автор

Type parameters for all generic methods (may be static or non-static) are declared just before the return type,
e.g. if someone defines a method as follows:
static public <T> Box<T> copy(Box<T> box) { ... }

type parameters for methods are local to the method independent of whether the method is static or not.
The type parameters of a generic class are not available in a static method of the class.

pravinjain
Автор

I'm so stoked about a Cracking the Java Code Interview about PECS!

larryd
Автор

Prof. Paumard it would be so helpful if you can create a proper long video on "creating Java APIs that use generics"

MakeItStik
Автор

could you please turn doen the music
also raise your voice alittle bit

khalilelemam
Автор

Interesting. In C# type declaration is right after method name.

ForgottenKnight
visit shbcf.ru