CodeGym /Courses /New Java Syntax /Tasks with and without asterisks

Tasks with and without asterisks

New Java Syntax
Level 4 , Lesson 10
Available

"Hello, soldier!"

"Hello, Captain Squirrels, sir!"

"I have great news for you. Here are some exercises to reinforce your skills. Work on them every day, and your competence will grow exponentially. They were specially designed for IntelliJ IDEA."

4
Task
New Java Syntax, level 4, lesson 10
Locked
Decent pay
Using a loop to display the following phrase one hundred times: "I will never work for peanuts. Amigo" Display each value on a new line.
4
Task
New Java Syntax, level 4, lesson 10
Locked
Somewhere in the middle
Use the keyboard to enter three numbers, and then display the middle number. In other words, not the largest and not the smallest. If all the numbers are equal, display any one of them.
4
Task
New Java Syntax, level 4, lesson 10
Locked
Adding
Let's write a program where we need to enter numbers from the keyboard, and as soon as -1 is entered, then we display the sum of all the entered numbers on the screen and exit the program. -1 should be included in the sum. Hint: One of the solutions to this problem uses the following construct: whi
Comments (57)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
nealgoogs Level 21, Eliot, United States
19 August 2024
you can use break in the last question.
Donkasking Level 6, United States
7 August 2024
That last one was a doozy! For future challengers, the placement of where you parse your integers matters!
Chris Christi Level 6
6 June 2024
8 attempts?!! OMG, am I too thick to be a Java developer?!!!
tri bui Level 6, Saigon, Viet Nam
28 May 2024
lesson learn: "read you test carefully!"
Luke Level 5, Saint Paul, United States
19 February 2024
Codegym you think you're sooooo smart making us include -1 in the summation ;)
Rather Be Coding Level 14, Detroit, United States
26 August 2023
So, you want to add -1 as well? Strange if we're breaking when that is entered.
Reganralph Level 6, DORTMUND, Germany
15 June 2022
int b = 0; while (true){ int a = Integer.parseInt(bb.readLine()); if (a<=-1){ b = b+a; System.out.println(b); break; } b=b+a; } please cna i get help as to why this SAYS Be sure that the program works correctly with negative numbers.
rags 3 Level 5, Wichita, United States Expert
5 July 2023
you need your if statement farther down i think below b+a
Ali_Alshehri Level 6, Saudi Arabia
19 May 2022
I use bubble sort algo to order number and then print the middle one
tri bui Level 6, Saigon, Viet Nam
28 May 2024
calm down bro. we have not learn bubble sort yet
Romant Level 15, Russia, Russian Federation
17 April 2022
Hi guys! To my mind, the Best way of learning the Codegym course is following. (1) Solve tasks by your own, using the Codegym help section, comments, or even web search - its really ok! Get used to it. (2) After you Verified a task, Download correct solution. >> Push the Help button in the task menu. (3) Correct your own solution in efficient and short way. Actually, it was the best way to correct my code and understand it. Sometimes I had Bullshit-code, dont know how it worked %)))))
Nikita Petrov Level 30, Astrakhan, Russian Federation
9 March 2022
I used 3 attempts to understand that in the "Adding" task "<0" and "== -1" are not the same.