"Hey, soldier!"

"Good day, Captain!"

"I've got awesome news for you. Here are some exercises to reinforce your skills. Do them every day and your skills will grow at an insane speed. They were created especially for IntelliJ IDEA."

4
Task
Java Core,  level 6lesson 13
Locked
Thread.currentThread always returns the current thread
1. In the printMsg method, assign the current thread to the variable t. 2. In the printMsg method, add a delay of 1 millisecond after all the actions.
4
Task
Java Core,  level 6lesson 13
Locked
Consecutive threads
1. In the run method, add a delay of 10 milliseconds after all the actions. Display "Thread interrupted" if the thread is interrupted. 2. Make all the threads run sequentially: first, for thread 1, count down from COUNT to 1; then for thread 2 - from COUNT to 1, etc. Example: #1: 4 #1: 3 ... #1: 1 #
18
Task
Java Core,  level 6lesson 13
Locked
Creating threads recursively
1. Change the GenerateThread class to make it a thread. 2. Create a GenerateThread constructor, which must: 2.1. Call the superclass's constructor, passing the created thread's number as a String. Use createdThreadCount. 2.2. Start the current thread. 2.3. The thread numbers must start with 1. 3. O
4
Task
Java Core,  level 6lesson 13
Locked
Consecutive threads
1. Figure out what the program does. 2. Make the program first display the result of the thread, and when the thread has finished then the main method continues. 3. Example output: inside MyThread 0 inside MyThread 1 ... inside MyThread 9 inside main 0 inside main 1 ... inside main 9
4
Task
Java Core,  level 6lesson 13
Locked
Deadlock
1. Figure out how the program works. 2. Without changing the T1 and T2 classes, make it so their threads finish (not necessarily successfully). 3. Don't use the sleep method.
9
Task
Java Core,  level 6lesson 13
Locked
Following a pattern
Figure out how the program works. Similar to CountdownRunnable, create a CountUpRunnable thread that displays values ​​in the counting order: from 1 to number.
18
Task
Java Core,  level 6lesson 13
Locked
Shall we play?
Three people play the game. Each player (Gamer) is characterized by two parameters: last name (name) and the actions-per-second (rating). Display the actions taken and determine the winner and the losers. Let's begin... 1. Figure out what the program does. 1.1. List actions stores the sequen
18
Task
Java Core,  level 6lesson 13
Locked
The early bird gets the worm
1. Figure out what the program does. 1.1. Each thread should read lines from the console. Use the existing static BufferedReader reader. 1.2. Use AtomicInteger readStringCount to calculate how many lines all the threads have read from the console. 2. Implement the run method: 2.1. As long as a thr
9
Task
Java Core,  level 6lesson 13
Locked
Take your turn!
1. In the Solution class, create a public static Read3Strings class that inherits Thread. 2. In the run method, read three lines from the console. 3. Three lines should be read in succession on one thread and combined into one space-delimited string. 4. In the main method, display the result for eac
18
Task
Java Core,  level 6lesson 13
Locked
Sequential file output
1. Figure out what the program does. 2. In a static block, read 2 filenames: firstFileName and secondFileName. 3. Inside the Solution class, create a public static ReadFileThread class that implements the ReadFileInterface interface (Think about what is more appropriate: Thread or Runnable). 3.1. Th

"Those previous exercises were for rookies. I've added some more advanced bonus exercises for the old-timers. Just for veterans."

18
Task
Java Core,  level 6lesson 13
Locked
Factory method pattern
1. Take a careful look at the classes you have. 2. In separate files in the common package, create JpgReader, PngReader, and BmpReader classes that implement the ImageReader interface. 3. In a separate file in the main package, create the ImageReaderFactory class with one method. 3.1. Think about wh
18
Task
Java Core,  level 6lesson 13
Locked
Clew
1. Create 5 different threads that differ from Thread: 1.1. Thread 1 must run indefinitely; 1.2. Thread 2 should display "InterruptedException" when an InterruptedException occurs; 1.3. Thread 3 should display "Hurray" every half second"; 1.4. Thread 4 must implement the Message interface. When the
18
Task
Java Core,  level 6lesson 13
Locked
Debug everything under the sun
Figure out what the program does. Read about UncaughtExceptionHandler - it's important. Take another careful look at the program. Figure out why our OurUncaughtExceptionHandler doesn't work (use the debugger). Fix the bug, i.e. everything should work. :) Expected result in no particular order: Thre