Beginner programmer here.
I have to append strings of file names together and have come up with the following methods:
class ConsLoItem implements ILoItem {
Item first;
ILoItem rest;
ConsLoItem(Item first, ILoItem rest) {
this.first = first;
this.rest = rest;
}
public String images() {
if (this.rest.equals(new MtLoItem()))
{
return this.first.images();
}
else
return this.first.images() + ", " + this.rest.images();
}
}
and keep getting the same results, with:
", jesse.jpeg, " when I expect "jesse.jpeg".
Any ideas on how to remove the ", " from the beginning and end of the file name?