при добавлении всего кода в один солюшен
я должен добавлять static В public static class RepkaStory
когда отдельно они лежат то в нём статика нет.
вопрос почему так?
public static void main(String[] args) {
List<Person> plot = new ArrayList<Person>();
plot.add(new Person("Репка", "Репку"));
plot.add(new Person("Дедка", "Дедку"));
plot.add(new Person("Бабка", "Бабку"));
plot.add(new Person("Внучка", "Внучку"));
RepkaStory.tell(plot);
}
public static class RepkaStory {
static void tell(List<Person> items) {
Person first;
Person second;
for (int i = items.size() - 1; i > 0; i--) {
first = items.get(i - 1);
second = items.get(i);
second.pull(first);
}
}
}