java - Instantiate parameterized type using Class.forName -
i have following classes:
public class b { } public class a<b> { }
how instantiate class a
using class.forname
, given have 2 string variables:
string classnamea = "a"; string classnameb = "b";
due type erasure, there won't generic classes @ run time.
for instance, following piece of code output class java.util.arraylist
without generics:
list<string> list = new arraylist<string>(); system.out.println(list.getclass());
Comments
Post a Comment