I was having an issue creating an ArrayList on 3/13. It told me that it could not find the symbol ArrayList. The fix for this is to write import java.util.ArrayList;
at the top of the file. Your code should look like this:
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
}
}
import java.util.ArrayList;
us telling Java that you want to use the ArrayList class, so it includes the code for ArrayLists with your program. If you don’t tell Java that you want to use ArrayList, it won’t know what you’re talking about when you try to use it.