筑波是日本新兴科学城,位于东京东北60千米筑波山西南麓。这里有40多个科研机构和2所大学
是你老妈
改成这样:(选择最佳啊)
import
java.util.ArrayList;
class
H/*你的类名*/
{
public
static
void
main(String[]args)throws
Exception
{
ArrayList
collection2=new
ArrayList
collection2.getClass().getMethod("add",
Object.class).invoke(collection2,"ABC");
System.out.println(collection2.get(0));//ABC
ArrayList
collection3=new
ArrayList
collection3.getClass().getMethod("add",
Object.class).invoke(collection3,(Integer)1);
System.out.println(collection3.get(0));//java.lang.Integer
cannot
be
cast
to
java.lang.String
}
}