Yes,
static method can be generic.
class
GenericStaticMethod {
static <T> T
method(T t) {
return t;
}
public static void
main(String[] args) {
String s=GenericStaticMethod.<String> method("static generic");
System.out.print(s);
}
}
Output:
static generic
No comments:
Post a Comment