I am trying to turn my array into an arraylist and I am having trouble modifying this part of my class. I don’t have my complete class but this part of it.
public boolean add(String title, int productID){//true or false statement
if ( numberOfRecords == list.length() ){ // I get an error here at list.length()
return false;
}
else
{ list [numberOfRecords] = new MyArrayList(title, productID);// I get an error
numberOfRecords++;
return true;
}
}
To use a List in place of an array you’ll have to make the following changes:
list.length()tolist.size()list [numberOfRecords]list.add(new Movie(title, productID))