I have CarService.java class, List of car and getter inside. Like this:
public class CarService {
public Scanner scanner;
private List<Car> cars;
private List<Person> persons;
private List<BankAccount> accounts;
public List<Car> getcarlist() {
return cars;
}
private void initalizeCars() {...}
Another Class Car.java. Here I want to use
CarService.getcarlist().add(rest...)
The error is: Non-static method 'getcarlist()' cannot be referenced from a static context