CodeGym /Courses /Java Syntax /Practice with lists

Practice with lists

Java Syntax
Level 7 , Lesson 9
Available

"Finally, you're done. I'm tired of trying to keep your tasks in my head. Here's a couple more to keep you in shape:"

7
Task
New Java Syntax, level 7, lesson 9
Locked
The Breakout story
Hey, Level 6 is coming to an end! You've completed some difficult but useful tasks. Before you move on to the Level 7, you should rest a bit. Get inspired to reach new heights by watching how the most famous Silicon Valley duo, Steve Jobs and Steve Wozniak, took their first steps and created a game called Breakout.
Comments (76)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
larsintech Level 16, Switzerland Expert
27 January 2025
Remember that you can't simultaneously traverse a list and add/remove elements
Mindaugas Level 23, Lithuania
5 September 2023
in first task - Words in reverse, if you create second ArrayList for solution, it will not pass testing, although everything is working, so think of more simple solution :)
Rebecca Zee Level 10, New York, United States
18 July 2023
The More Sam-I-Am task shouldn't even be considered medium. I would consider it an easy task. I didn't even have to use any looping to add any elements into the ArrayList. If you paid attention to the lesson right before this, it shouldn't even be hard to do.
Anonymous #10782038 Level 24, United States of America
18 March 2024
its not medium, its listed as an easy..
Xavi Martin Level 22 Expert
25 October 2022
Can someone explain to me what this symbol means? ->
Dzmitry Antsipin Level 29, Berlin, Germany
22 December 2022
It's about lambda expressions - we'll meet with it afterwards
Michael Amann Level 22, United States of America, United States
21 April 2022
I think showing the students how to read from a file earlier would help immensely in testing. Instead of typing over and over you could just read from a file to test input and NOT have to take that code out and implement another input method to submit.
ayadi1 Level 18, berkane, Morocco
30 April 2022
i think so 😬
AHMET YORULMAZ Level 8, Germany, Germany
27 October 2021
"If half or more of your actions seem to be meaningless, don't worry: you probably clearly understand the fragility of existence"👍
Justin Smith Level 41, Greenfield, USA, United States
11 July 2021
A hint that makes quite a few of these much easier... a for loop is not required to start counting from small to large. You can go the other way (i.e. for(int i = 9; i >= 0; i--) instead of for(int i = 0; i < 10; i++). This is really useful when removing elements from an arraylist or adding them into a specific location, where you don't want to affect the index values of the elements you have yet to iterate through.
Romant Level 15, Russia, Russian Federation
22 April 2022
Thankyou! Idea of backward looping helps to avoid exception on members numbering when adding new members.
DarthGizka Level 24, Wittenberg, Germany
29 May 2021
task0715 (More Sam-I-Am) caveat: you will get failed if you initialise the ArrayList and fill it in one go. They want you to add the initial three strings in a separate statement to an initially empty list (but Collections.addAll() gets accepted for that, for example).
Gokhan35 Level 37, Izmir, Turkey
5 January 2022
ArrayList<String> list = new ArrayList<String>(Arrays.asList("Sam", "I", "Am")); I did it like this but you have to import the Arrays class using; import java.util.Arrays;
Libby Level 2, United Kingdom
17 January 2021
Is there any way to see output and input on IntelliJ?
Olha Level 40, Fremont Expert
18 January 2021
Please contact the support team at support@codegym.cc for further assistance.
Ajani Level 16, Jacksonville, United States
9 January 2021
So i notice this a lot recently when i compare how I solve a problem to how site's coders solved it. When forming an array or list, and taking entries from a keyboard the site's programmers almost always write the entry to a variable before then taking that variable and adding it to a list. Why take the extra step? why not just code the typed entry directly into your list/array?
DarthGizka Level 24, Wittenberg, Germany
29 May 2021
Catching a value in an explicit variable has several advantages: * you can give the value a name that tells you what it means (can be important with complicated math) * it allows you to watch the value in a debugger * it helps with breaking complex tasks/expressions into simpler, more elementary ones that are easier to process for humans; this means fewer coding errors when writing code and less overload when reading it