A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© aguang 中级黑马   /  2015-8-21 07:46  /  420 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

package cn.tt5;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;

public class Test03 {
        public static void main(String[] args) {
        Collection c=new ArrayList();
       
        Student s1=new Student("hello",12);
        Student s2=new Student("word",33);
        Student s3=new Student("jav",22);
       
        c.add(s1);
        c.add(s2);
        c.add(s3);
       
        Obeject[] objs=c.toArray();
       for(int i=0;i<objs.length;i++){
           Student sc=(Student)objs[i];
           System.out.println(sc);
        }
}


1 个回复

倒序浏览
66666666666
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马