Java Multithreading Tutorial for Beginners #2: Why do we need multiple threads ?

Published: 17 February 2019
on channel: Genuine Coder
8,537
108

In this chapter, we will talk about the requirement of Threads. Threads require some extra handling/coding and changes in your program code. Then why should we use it ?

We will create a single Java Swing based application and will see the effect of running a complex loop in main thread. When we run processor intensive code on main thread, the processor will not be available for GUI rendering. This will cause application to not respond to user interactions and thereby cause crashes.

We will see how using a simple thread we could get rid of the application freezing.

We have 2 threads in this application.
1. Main thread
2. Thread that computes the sum from 1..N


You can find the source code of this chapter in the following GitHub repository.
https://github.com/afsalashyana/Java-...


Website:-
https://www.genuinecoder.com

#Multithreading
#GenuineCoder
#Java


Watch video Java Multithreading Tutorial for Beginners #2: Why do we need multiple threads ? online without registration, duration hours minute second in high quality. This video was added by user Genuine Coder 17 February 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8,53 once and liked it 10 people.