是否可以将 Objects 实例类型作为泛型的类型参数传递?类似于以下内容:
Object obj = new Double(3.14); //Instance type Double
//Could I do the following?
Item<obj.getInstanceType()> item = new Item<obj.getInstanceType()>(obj);
public class Item<T> {
private T item;
public Item(T item) {
this.item = item
}
public T getItem() {
return this.item;
}
}