I create class level static ArrayList by the following line.
static ArrayList<Student> studentList = null;
Then I create and fill ArrayList with some objects inside a function.
studentList = new ArrayList<Student>();
Write(student);
later I want to clear all of my ArrayList elements
studentList = new ArrayList<Student>();
Will my ArrayList removed and create a variable call studentList again by the above line??
or is it a good practice to clear like below??
studentList.clear();
or both
studentList.clear();
studentList = new ArrayList<Student>();