java 引用类型数组

java 引用类型数组
在C中的数组可以用下标来找到特定的元素,在java中如果定义了一个类的数组,比如 Student类,Arraylist Student = new Arraylist();怎么指定特定的 元素,比如student[4],
还能调用student的方法吗?

建议写成:ArrayList<Student> students = new ArrayList<Student>();
可以使用 Student student = students.get(4);
然后student就是Student的实例了
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜