My first thread
The grand moment arrived at last! Brace yourself: you have to create your very own thread. Create a public static TestThread class, a thread with the Runnable interface.
My second thread
Let's continue to unravel threads. This time, we need to create a public static TestThread class that inherits the Thread class. Then we'll create a static block inside TestThread, which will display "This is the static block inside TestThread". And the run method should display "This is the run method".
A list and some threads
Let's multiply threads again and again. In the main method, add five threads to the static list. Each thread must be a new Thread object that works with its own SpecialThread object. The SpecialThread class's run method should display "This is the run method inside SpecialThread".
Displaying a stack trace
Do you still remember about the stack trace and the fact that the currently running method is at the top of the stack? Let's recall this by completing a task: you need to create a "task" (a public static class called SpecialThread that implements the Runnable interface). SpecialThread should display its own stack trace.
Let's talk music
Even robotic programmers yearn for art! Today we're talking about bowed string instruments. We have a Violin class. You need to change it to make it a task for a thread. To do this, use the MusicalInstrument interface. And then you can "play" it and display how long you've been playing.