ArrayList<Student> list = new ArrayList<Student>();与ArrayList<String> list = new ArrayList<String>();是否有区别?
ArrayList<Student> list = new ArrayList<Student>();与ArrayList<String> list = new ArrayList<String>();是否有区别?
肯定有区别的。
ArrayList<Student> list = new ArrayList<Student>(); //list里面保存的元素是Student类型的对象
ArrayList<String> list = new ArrayList<String>(); //list里面只能保存字符串