How to create a new Thread in Java / Various methods to create a Thread in Java

A little bit about thread

A thread is a piece of task which is to be executed in parallel to another task executed by an application.
Example, Consider a text editor which performs auto save operation after some particular length of text is typed into it.
Now there are two tasks, first showing the text typed into the editor and second, performing auto save.
Since the two tasks should be executed in parallel, they are performed in different threads. If both operations are done on the same thread, then while the thread is busy saving, it could not perform the typing process and it will show a lag till the save operation completes.

How to create Thread ?

There are a couple of ways of creating a thread. (more…)

Continue Reading
Close Menu