Literally everything is public and everything should be right and everything is synced. CodeGym drives up the effing wall sometimes. It is such shit at explaining anything clearly especially the requirements for their tasks. I always feel like I am being asked to do things by a two year old that doesn't know how to express himself.
package com.codegym.task.task17.task1705;
import java.util.ArrayList;
import java.util.List;
/*
Time in the garden
*/
public class Solution {
public static void main(String[] args) {
}
public static class Garden {
public static final List<String> fruits = new ArrayList<>();
public static final List<String> vegetables = new ArrayList<>();
public synchronized static void addFruit (int index, String fruit){
fruits.add(index, fruit);
}
public synchronized static void removeFruit (int index){
fruits.remove(index);
}
public synchronized static void addVegetable ( int index, String vegetable){
vegetables.add(index, vegetable);
}
public synchronized static void removeVegetable ( int index){
vegetables.remove(index);
}
}
}