美文网首页
2020-07-22

2020-07-22

作者: 324_d5df | 来源:发表于2020-07-22 15:28 被阅读0次

1.case穿透
2.while(true)的理解
3.关于ArrayList中的元素修改

public static void main(String[] args) {
        ArrayList<Student> array = new ArrayList<Student>();
        Student student = new Student();
        student.setId("1");
        student.setName("张三");
        student.setAddress("北京");
        array.add(student);
        Student student2 = new Student();
        student2.setId("2");
        student2.setName("张三2");
        student2.setAddress("北京2");
        array.add(student2);
        System.out.println(array);
        
        Student student1 = new Student();
        student1.setId("3");
        student1.setName("李四");
        student1.setAddress("南京");
        array.set(1, student1);//(索引,新的元素)
        System.out.println(array);
    }

相关文章

网友评论

      本文标题:2020-07-22

      本文链接:https://www.haomeiwen.com/subject/anftlktx.html