摘要: JAVA中集合的遍历的一种方法时集合转数组遍历,也是就调用Collection中的toArray(). 代码: public static void main(String[] args) { // TODO Auto-generated method stub Collection c=new A 阅读全文
posted @ 2016-06-05 20:24 MoMask 阅读(663) 评论(0) 推荐(0) 编辑
摘要: Collection中的add方法: 代码: public static void main(String[] args) { // TODO Auto-generated method stub Collection c=new ArrayList();//父类引用指向子类对象。这里是一个List 阅读全文
posted @ 2016-06-05 19:42 MoMask 阅读(562) 评论(0) 推荐(0) 编辑
摘要: 代码:Student [] sd=new Student[5];//新建一个学生类的数组对象sd。 sd[0]=new Student("kj",13);//为数组对象赋值。 sd[1]=new Student("zj",14); sd[2]=new Student("gj",15); sd[3]= 阅读全文
posted @ 2016-06-05 18:53 MoMask 阅读(462) 评论(0) 推荐(0) 编辑