几个定义泛型的例子 可以用于声明数组型态 public class GenericFoo3<T> private t[] fooArray public void setFooArray(t[] fooArray) this. fooArray fooArray public t[] getFooArray() return fooArray String[] strs =i"caterpillar",momor,bush") Genericfoo3<string> foo new GenericFoo3<string>o foo. setFooArray(strs)i strs = foo. getFooArray(几个定义泛型的例子 • 可以用于声明数组型态 public class GenericFoo3<T> { private T[] fooArray; public void setFooArray(T[] fooArray) { this.fooArray = fooArray; } public T[] getFooArray() { return fooArray; } } String[] strs = {"caterpillar", "momor", "bush"}; GenericFoo3<String> foo = new GenericFoo3<String>(); foo.setFooArray(strs); strs = foo.getFooArray();