3/13, ArrayList

What is wrong with my code?

Instructions: Inside of the main method, create an ArrayList object called weeklyTemperatures that will store Integer data types.

import java.util.ArrayList;

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

    }
}
Err: ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer> ();

At the end of the statement,  () this brackets must be written without blank space after " new ArrayList<Integer>"
so:
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>(); //this will be ok ;)
1 Like

HELP!! ArrayList 3/13 what’s wrong with this code
:point_down:
{ ArrayList weeklyTempretures = new ArrayList();

Figured it out it’s the Tempreture instead of Temperature. Moving on now :wink:

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