Coding Exercise: Threads

Test your understanding of threads.

Problem

This exercise uses Threads to display which Thread is used. Create a console application for a Threads app that meets the requirements below.

  1. Create three Threads.
  2. Create a method that counts to 100 and displays which Thread is running.

Sample input

There is no input required for this exercise.

Expected output

The finished output of the program should look like the example below (results will vary):

Thread C is running
Thread C is running
Thread C is running
Thread C is running
Thread B is running
Thread B is running
Thread B is running
Thread B is running
Thread B is running
Thread A is running
Thread A is running
Thread A is running
Thread A is running
Thread A is running
Thread A is running
Thread B is running
Thread B is running

Get hands-on with 1200+ tech skills courses.