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

preview_player
Показать описание
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.

Website:-

#Multithreading
#GenuineCoder
#Java
Рекомендации по теме
Комментарии
Автор

i Think u ment "sum = sum + i", not "sum = sum+inputnumber"... because what you´re doing here is calculating inputnumber * inputnumber instead of the sum of natural number from 1 to input number which is what u said you were doing... but it doesn't matter for the subjects of threads.. great video.

davidematos
Автор

Hey man u gotta make ur text larger its difficullt to see in 360p and zoom in while exploring options

patrickjason
Автор

Fabulous video but your keyboard sounds more than you bro

addler