"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.
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 :)
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.
Can someone explain to me what this symbol means? ->
Michael AmannLevel 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.
"If half or more of your actions seem to be meaningless, don't worry: you probably clearly understand the fragility of existence"👍
Justin SmithLevel 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.
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).
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?
My code passed the tests on Javarella, but I don't understand why this code worked:
int a = Integer.parseInt(bis.readLine())
In using the Integer.parseInt method, don't we convert a string into an int, that is a primitive value? How can that int then be added to an ArrayList when ArrayLists cannot take primitive values. Don't we have somehow use the Integer wrapper class to turn the int into an object? Thanks for any thoughts on this. Happy New Year 2021 to all! Donny
GO TO FULL VERSION