I have a class like this in Java:
public class Wrapper {
public static List<Type> list;
@Override
public String toString() {
return "List: " + this.list;
}
public static void main(String[] args) {
Wrapper w = new Wrapper();
System.out.println(w);
}
}
and a class like this:
public class Type {
private static String name;
public Type(String n) {
this.name = n;
}
@Override
public String toString() {
return this.name;
}
}
Instead of getting the name of each item, I get the name of the last item for each item in the array. Any suggestions?