I was looking at some code and I saw the following method.
ArrayList<Invoices> a = createData();
private static ArrayList<Invoices> createData() throws ParseException {
ArrayList<Invoices> a = new ArrayList();
a.add(new Invoices(1, "Book"));
a.add(new Invoices(2, "Table"));
a.add(new Invoices(3, "Lamp"));
return a;
I understand what the method itself does but I'm confused on how it's called. Why is there the name of the Array list in the method declaration header?
CodePudding user response:
ArrayList<Invoices>
This is the type of the value returne by the method.
CodePudding user response:
ArrayList<Invoices>
It is returned value by function createData()