The thread that is ready to run, but waiting for the processor availability is called the runnable thread(runnable state).The runnable interface consists of a single method run() which is required for implementing thread.
The processor can execute only one thread at a time and the thread priority decides the thread is allowed to run. By using setPriority() we can set the priority of the thread of the various threads. Here priority means Order of execution.
Multithreading means we can divide the program into two or more subprograms. All the subprograms can be implemented at the same time in parallel.We use run() for executing the sequence of code that the thread will execute.
The applet is used to display coloured bubbles of different sizes(all bubbles are of different size).
The choice or selection of the colour or size is done randomly. The array colors(colors) is used to store the different colours.
The Math.random() is used to randomly select the colour from the colors array and to calculate the size of the bubble.