I have the following class and I am now supposed to add a parameter T, so that the value of Variable <T> is of type T rather than object.
I am now lost with this and need some help. Not getting the generic classes.
public class Variable {
private Object value;
private String name;
public Variable (String aname, object avalue){
name = aname;
value = avalue;
}
public String getName (){ return name; }
public Object getValue() {return value;}
public void setValue ( Object nvalue ){
value = nvalue;
}
public String toString (){
return name + " = " + value;
}
}
Thanks in advance.