So I was working on a school project and was given the first few lines of code
ArrayList<Person> people;
public MyPersonListV1(){
people = new ArrayList<Person>();
//other stuff
}
I was wondering why you would instantiate the object in the constructor instead of above it with the declaration like this:
ArrayList<Person> people = new ArraList<Person>();
public MyPersonListV1(){
//other stuff
}