Error in Example Code in Learn Java: ArrayLists Lesson

In Learn Java: ArrayLists, Accessing Index, there is an error or typo in the example code given in the explaination.

The example code given is as follows:

ArrayList<String> shoppingCart = new ArrayList<shoppingCart>();

shoppingCart.add("Trench Coat");
shoppingCart.add("Tweed Houndstooth Hat");
shoppingCart.add("Magnifying Glass");

System.out.println(shoppingCart.get(2));

In this code the second set of angular brackets contain shoppingCart, but I think they should contain String, like with the first set. I tried testing the code as given to see if it would work and it gave an error, but when I made the change I mentioned it functioned as the explaination said it would (prints out Magnifying Glass).

To be clear, this is found in the explaination on the left, not the pre-written code in the middle.

https://www.codecademy.com/courses/learn-java/lessons/learn-java-arraylists/exercises/accessing-an-index

Before Submitting a Bug Report be sure to browse #get-help and #faq where your issue might be explain/solved.

To gather information for a bug report we need the following information:

Topic Title: Course name + section + what type of bug(is it a typo, instructions error, broken URL, SCT issue)

For the Post:

Summery of the report:
Course URL:
Steps to Reproduce:
Fix or Workaround:
Please attach screenshots

Please also tag your bug report with the appropriate language.

Thank You we appreciate your assistance in making Codecademy a better learning place!

1 Like

Hi, thanks for reporting this.

Iā€™ll take a look shortly and come back to you. :slight_smile:

1 Like