I have a problem with a constructor that takes an array of List as one of the arguments.
public class ItemisedProductLine extends ProductLine{
public static ArrayList<String> serialNumbers;
public ItemisedProductLine(String productCode, double recRetPrice, double salePrice, int quantity, String description, ArrayList<String> SerialNumbers){
super( productCode, recRetPrice, salePrice, quantity, description);
this.serialNumbers = serialNumbers;
}
}
Now in my Inventory class I want to instantiate a new ItemizedProductLine and pass the serial number arryList to the constructor
ItemisedProductLine item = new ItemisedProductLine("productCode", 2600, 2490, 2, "descrpition", new ArrayList<String>("1233456", "6789123"));
Is this possible in Java? This does not seem to be a common task, but found no example.
Alternatively, I could use a shared array instead of an Array-List, but then I cannot initialize it due to an unknown size
I hope I do not forget another bracket :-)
The last thing is the error: "No suitable ArraList constructor was found <>"
source
share