Hi,
I have this code from a site and I tried to run it but have an error.
the error is:package myProject; import java.util.ArrayList; public class listArray2D { public static void main(String[] args) { ArrayList<ArrayList<String>> groceryList = new ArrayList(); ArrayList<String> bakeryList = new ArrayList(); bakeryList.add("pasta"); bakeryList.add("garlic bread"); bakeryList.add("donuts"); ArrayList<String> produceList = new ArrayList(); produceList.add("tomatoes"); produceList.add("zucchini"); produceList.add("peppers"); ArrayList<String> drinksList = new ArrayList(); drinksList.add("soda"); drinksList.add("coffee"); groceryList.add(bakeryList); groceryList.add(produceList); groceryList.add(drinksList); System.out.println(groceryList); } }
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
ArrayList cannot be resolved to a type