how? enter code here Split the read line into parts; Create a brand from input data(parts); Add the brand to this list;
ArrayList<String> str1 = new ArrayList<>();
loadFromFile(file, str1);
for (String string : str1) {
String[] str = string.split(",");
//EG line of file: B7-2018, BMW 730Li (2018), Harman Kardon, 3.749
String id,name,sound;
double price;
id = str[0];
name = str[1];
price = Double.valueOf(str[3]);
sound = str[2];
Brands brand = new Brands(id, name, sound, price);
this.add(brand); /// this is arraylist of Brands (extends ArrayList Brands)
//error code: ArrayIndexOutOfBoundsException
//I do not understand this