java如何摆脱arrayList中的匿名对象?
ArrayList<Object> ingred = new ArrayList <Object>();
ingred.add(new Cup()); // From class Cup
ingred.remove(Cup); // Cup cannot be resolved to a variable
无法使用任一删除方法。请帮忙
你可以在下面搜索框中键入要查询的问题!
ArrayList<Object> ingred = new ArrayList <Object>();
ingred.add(new Cup()); // From class Cup
ingred.remove(Cup); // Cup cannot be resolved to a variable
无法使用任一删除方法。请帮忙
# 1 楼答案
让它不那么“匿名”怎么样?比如存储对它的引用: