public class Test {
public <T extends Node> Test (T node)
throws InstantiationException, IllegalAccessException {
T t = (T)node.getClass().newInstance();
System.out.println(t.getClass().getName());
}
public static void main(String[] args)
throws InstantiationException, IllegalAccessException {
new Test(new Pane());
}
}
在不理解为什么这是必要的情况下,根据所描述的任务判断,你可以这样做......