undefined

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:"

undefined
10
Task
Java Syntax, level 7, lesson 9
Locked
Playing Javarella
Javarella 1.0: Dealing numbers into three lists. Here are the rules: Javarella receives a list of 20 numbers. You need to check which of them is divisible by 3, which by 2, and which are divisible by neither. Then the program needs to save them to separate lists. Numbers divisible by both 3 and 2 (for example 6) go into both lists. Let's dive in!
undefined
2
Task
Java Syntax, level 7, lesson 9
Locked
Words in reverse
If half or more of your actions seem to be meaningless, don't worry: you probably clearly understand the fragility of existence, and can therefore become a great programmer. Then again, sometimes it just seems that way. Here's some meaning for your life: enter 5 words and put them in a list. Remove the third element of the list, and display the remaining elements in reverse order.
undefined
5
Task
Java Syntax, level 7, lesson 9
Locked
More Sam-I-Am
From now on, green eggs and ham will be overshadowed by lists. Or would the opposite be better? Here's our task: add some of Dr. Suess's famous words to a list: "Sam", "I", "Am". After each word, we'll insert "Ham" into the list. And display the result on the screen. Each list element on a new line.
undefined
10
Task
Java Syntax, level 7, lesson 9
Locked
R or L
Our friends from Planet Chi-Knees have an unusual problem: they have a really hard time distinguishing between the letters "r" and "l". We decided to help them with this task. The experimental fix method will remove from a string list all words containing the letter "r", and it will duplicate all words containing the letter "l".
undefined
5
Task
Java Syntax, level 7, lesson 9
Locked
Duplicating words
Let's write an echo program. It repeats everything it hears. More precisely, everything in a list of 10 strings. The echo program will actually accomplish this by creating a list of 10 words (we'll enter strings from the keyboard and add them to the list), and the doubleValues ​​method will basically duplicate the words in a specific way. Then we'll display the resulting echo. Piece of cake.
undefined
5
Task
Java Syntax, level 7, lesson 9
Locked
Checking the order
Hierarchy is a dictator's first tool for maintaining order and military control. We'll think about a dictatorship later. For now, let's make a list of 10 words. Let's use the keyboard to enter them. Our task is to check whether the list is ordered by increasing string length. If not, we'll display the index of the first element that violates this order.
Comments (62)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Libby Level  15, London, United Kingdom
17 January 2021
Is there any way to see output and input on IntelliJ?
Ajani Level  8, 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?
Donny Level  14, San Francisco, United States
3 January 2021
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
Mihai Bone Level  8, Bucharest, Romania
4 December 2020
Checking the order : I did try for 30 minutes and failing all the times. Display the Index ( that small detail killed me), I was displaying the length.
Mina Level  8, Rome, Italy
3 December 2020
"The program ran too long" this is the message to verify the task..What does it mean?????HELP
Chandan Thapa Level  22, Dubai, United Arab Emirates
16 October 2020
Level 7, Lesson 9 took the longest time for me. And out of all tasks the longest time to figure out was the R and L task. Until i had scroll through the comments here and Agent Smith's short but sweet example did wonders.
Ishika Paul Level  8, Bangalore, India
11 October 2020
further helping article for task R or L: https://stackoverflow.com/questions/11624220/java-adding-elements-to-list-while-iterating-over-it
Agent Smith Level  38
15 August 2020
You might find this method useful in some of the tasks:

String example = "baobab";
boolean result = example.contains("ba");
Brad Reed Level  19, Hartford, United States
29 June 2020
Bad internet is the bane of productivity.... guess I’ll try later.
Oliver Heintz Level  17, Mustang, United States
13 June 2020
Intellij keeps timing out when I go to verify my task. Everything compiles fine, and it seems as if I wrote the program correct, but I get a timeout error attempting to validate the program. How can I solve this issue? A Google search did nothing, and it isn't immediately clear where questions like this are addressed on this site.