Why do you recommend that the main thread be the last to finish? - Java

Why do you recommend that the main thread be the last to finish?

In an application, a program continues to run until all of the threads have ended. Hence, the main thread to finish at last is not a requirement. It is a good programming practice to make it to run last to finish. The application execution starts by invoking main thread and the chain follows. So it is inevitable that all the threads complete their execution. Soon after the completion of the execution the control returns to main thread. Thus the flow will not be missed. And it is the main thread that starts first and also ends first.
Why does Java have two ways to create child threads?
Java threads can be created graciously in two ways: implementing the Runnable interface and extending Thread class...
Tips on effectively using Multithreading - Java
In multiple processor systems, a large algorithm will split the process into threads. So that different processors can handle different threads...
Enumerations vs final variables in java
Enumeration is type safe. Where as final variables are not. Enumeration supports to have a blend of various values. Where as final variables does not support multiple values...
Post your comment