toString() a generic type in Java
- by davidrobles
How can I print the type of a generic java type?
Reflection? Any tricks?
public class Foo<K> {
private K element;
@Override
public String toString() {
return "Type: " + K;
}
}