CodeGym /Courses /Java Syntax /Tasks about object lifetime

Tasks about object lifetime

Java Syntax
Level 6 , Lesson 5
Available

"Hi, Amigo. A couple more tasks for you:"

6
Task
New Java Syntax, level 6, lesson 5
Locked
Multiplication table
Initialize the MULTIPLICATION_TABLE array as a new int[10][10], fill it with a multiplication table, and then display it on the console in the following form: 1 2 3 4 … 2 4 6 8 … 3 6 9 12 … 4 8 12 16 … … The numbers in each line are separated by a space.
6
Task
New Java Syntax, level 6, lesson 5
Locked
Cutting down the middle
You are given a two-dimensional chars array In the main method, you need to replace all interior elements with a hyphen (minus sign). Use the private printArray() method to display the contents of the array on the screen. Example array: a b c d e f j h i j k l m n o p q r s t u v w x After running
6
Task
New Java Syntax, level 6, lesson 5
Locked
Chess board
Let's create a program to generate square chessboards with a given dimension. In the Solution class, you have a two-dimensional array of characters (the array field). Requirements: - Read a number from the keyboard. This will be the dimension of our board (the length of a side); - Initialize the arr
Comments (66)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Franco Polizzi Level 11, Werther, Germany
19 July 2022
For the last task: Think carefully about the two operators "/" and "%"
Bill Level 8, United States of America
27 April 2022
A tip for those of you having trouble with the last task: If you divide an int by 10 you remove the last digit. So 89756 / 10 becomes 8975. Think about how you could use that in a loop.
Aldo Luna Bueno Level 1, Peru
20 November 2021
The key of the "Even and odd digits" task is this: In decimal base, (1) the units digit is even if the number is even and (2) the units digit is odd if the number is odd.
Hisham Thabet Level 8, Lahj, Yemen
9 August 2021
Thank you my God I do it just in one hour.
miguel Level 12, Corredor
10 July 2021
Hi everybody, my solution worked but I have this issue on intellij IDEA... "Exception in thread "main" java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:592) at java.lang.Integer.parseInt(Integer.java:615) at com.codegym.task.task05.task0532.Solution.main(Solution.java:19)" I don't know how to solved it... but the program don't run
Elektra Level 2, United States of America, United States
9 January 2022
It seems like you have a problem with your input. Double-check you input handling code.
Justin Smith Level 41, Greenfield, USA, United States
7 July 2021
Even and Odd digits is by far the hardest task so far. I've been staring at it for a full 20 minutes and haven't typed anything because I don't have a clue where to even begin. Been cruising through most of these tasks since Level 0 and I feel like I just hit a wall, haha.
Justin Smith Level 41, Greenfield, USA, United States
6 July 2021
I think "Cat & Dog Objects: 50,000 Objects" needs an update. Intellij IDEA displays the finalize method with a strikeout and says it is "deprecated". My validation passed, but when running the program it doesn't print any lines (my guess is that it's ignoring the finalize() method entirely due to it being deprecated).
WonJun Yoon Level 6, Seoul, Korea, Republic of
30 April 2021
Even and odd digits 에서 제일 중요한건 입력받은 숫자를 '나눠서 처리하기에' 적절한 메소드를 활용하는 것입니다. 저는 substring을 활용하였습니다만, for(int i=0; i<length; i++){num[length - i - 1] = number%10}와 같은 형태로 숫자를 나누는것도 고려해봄직 할 것 같습니다.
Ron R Level 2, Washington, United States
29 November 2020
Failing "Even and Odd" because "The displayed text must match the task conditions." It matches....don't understand why it's not passing validation.
envy Level 6, Detroit, United States
4 March 2021
Hey Ron, I see the same issue with my code where the output looks correct. Were you able to resolve this ?
John Clune Level 8, London, Canada
11 March 2021
Mine is working fine, your code should output this: Even: 2 Odd: 3
Lukasz Level 10, Ostrzeszow, Poland
4 April 2021
Even and Odd is already declared. I didn't notice that and declared my own....
Neil Hainer Level 25, Mount Laurel, United States
14 November 2020
Cat and Dog objects: 50,000 each I got this to work in CodeGym but when I ran it in IntelliJ (with Java JDK 12.0.2) I get the following message: finalize()' is deprecated
sreedhar s Level 9, Wellington, New Zealand
19 March 2021
yes for me finalize didnt print any statement in the console when running the solution, but the solution passed the test. I was using Java 1.8.