Is it possible to pass an Objects instance type as the type parameter of a generic? Something like the following:
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;
}
}