How can I get the \"real\" class of a generic type?
For Example:
public class MyClass { public void method(){ //something S
As others have explained, you cannot do it in that fashion but this is how it's usually achieved in java.
public class MyClass { public void method(Class clazz) { // something System.out.println(clazz.getName()); // something } }
and you use it like this
new MyClass().method(String.class);