Hello!
I have created a list of customer in a class called bank like this:
private List<customer> customerList = new LinkedList<>(); public List getCustomerList() { return customerList; }
Then I´ve added customers to that list via another test class. Now I want to print out the customer list via a for-loop in that class:
for (Customer c : bank.getCustomerList()) { code for print out }
I then get an error message saying: "Incompatible datatypes, Required Customer, Found: Object"
Why is that? I know that I can just declare the list as public and then call the variable directly, but I wanna know why the other version doesn't work.
Thanks!
/Hank