I am getting an error when compiling this Java code


#1


I was stuck in this execercise: ArrayList Object


This is the error I that the compiler is giving me:

Temperatures.java:6: error: cannot find symbol
ArrayList weeklyTemperatures = new ArrayList();
^
symbol: class ArrayList
location: class Temperatures
Temperatures.java:6: error: cannot find symbol
ArrayList weeklyTemperatures = new ArrayList();
^
symbol: class ArrayList
location: class Temperatures
2 errors


This is my code:

class Temperatures{
  
  
  public static void main(String[] args){
    
    ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();    
    
  }
  
}

I can not figure out why I am getting this error. Please help! Thank you.


#2

did you import java.util.ArrayList ?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.