read string arrays into an object array

You are reading every line, but only carrying the last line’s data through to the next step and reusing it over and over in the next for loop.

Instead, create and save a Clothes object every time you read a line, something like:

int ii = 0;
while ((line = br.readLine()) != null) {
    assets = line.split(",");

    name = clothes[0];
    style = clothes[1];
    colour = clothes[2];
    brand = clothes[3];
    clothes[ii++] = new Clothes(name, style, colour, brand);
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top