Multithreading in Java Explained in 10 Minutes

  Рет қаралды 872,458

Coding with John

Coding with John

3 жыл бұрын

Complete Java course: codingwithjohn.thinkific.com/...
Multithreading gives you some of the coolest capabilities in Java. It's built in to the Java language.
But it can be confusing getting to learn it! Multithreading is tough to grasp at first in Java, but this beginner-friendly video will give you the ability to run simple programs in multiple threads at the same time in your Java programs.
We'll talk about 2 different ways to get your Java multithreading working, and which one I use myself.
Learn or improve your Java by watching it being coded live!
Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
Let me know what else you'd like to see!
Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
📕 THE best book to learn Java, Effective Java by Joshua Bloch
amzn.to/36AfdUu
📕 One of my favorite programming books, Clean Code by Robert Martin
amzn.to/3GTPVhf
🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
www.audibletrial.com/johnclean...
🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
bit.ly/3QPNGko
📹Phone I use for recording:
amzn.to/3HepYJu
🎙️Microphone I use (classy, I know):
amzn.to/3AYGdbz
Donate with PayPal (Thank you so much!)
www.paypal.com/donate/?hosted...
☕Complete Java course:
codingwithjohn.thinkific.com/...
codingwithjohn.com

Пікірлер: 849
@euroticker4828
@euroticker4828 2 жыл бұрын
Literally explains more than my Professor does in 6 hours, God bless you John.
@sin_alpha3373
@sin_alpha3373 2 жыл бұрын
Bcs he uses human language
@barbe7818
@barbe7818 2 жыл бұрын
Implementing the interface is literally more relevant than extending a class limited by a single inheritance, thanks a lot for mind illumination 💡in Java ^L^
@sahilbaori9052
@sahilbaori9052 2 жыл бұрын
Wait, multi threading is covered in uni?
@richskater
@richskater 2 жыл бұрын
@@sahilbaori9052 If you go to a school that's known for it's CS program, maybe. If you're like me and went to school that's known for it's Nursing and Social Work programs, but just happens to have a CS program, then I highly doubt it. "Advanced Data Structures" was just stacks and queues, we never got into hashmaps and stuff. "Software Engineering" (a 3rd year course) was the first mention of inheritance and it was just "you could, in theory...", not a "here's how, overwrite this, something something polymorphism". By the end I hadn't learned anything that wasn't covered in my AP Java book from Highschool.
@FlexGC
@FlexGC 2 жыл бұрын
@@richskater sounds like ez degree
@69k_gold
@69k_gold 2 жыл бұрын
Used multithreading to create 5 Google accounts at the same time to like this video 5 times
@musicalminute1287
@musicalminute1287 Ай бұрын
And that’s exactly what multithreading is not meant to be used
@jodathassan8894
@jodathassan8894 4 күн бұрын
Omg really?????
@keoniromano1479
@keoniromano1479 Жыл бұрын
This man can teach this stuff so much more effectively and clearly in a few seconds just to get it out of the way than any of the teachers I've had in school trying to explain in "detail" after telling you that it's "just the way it is" for like a month. Respect.
@CodingWithJohn
@CodingWithJohn Жыл бұрын
Thanks a ton!
@Kazner0h
@Kazner0h 11 ай бұрын
Bro that "It's just how things are" explanation is the WORST.
@HocineFerradj
@HocineFerradj 7 ай бұрын
He deserves it
@Ninnz_
@Ninnz_ 6 ай бұрын
I confirm
@pt_trainer9244
@pt_trainer9244 2 жыл бұрын
Don't know why this doesn't have more views. Very clear and straight to the point explanation. Thank you =)
@javoxirabdullayev5038
@javoxirabdullayev5038 2 жыл бұрын
It is just a beginning
@misterdneh
@misterdneh 2 жыл бұрын
Probably because people code incorrectly 😆
@sianwa11
@sianwa11 8 ай бұрын
Java was my first language but I quickly dropped it because of how complex it was. I'm on a relearning journey and your videos are really helpful. Thanks!
@cobalt79R
@cobalt79R 2 жыл бұрын
After 5 years of software engineering, I wouldn’t guess I would learn multithreading in 10 mins. Thanks for this awesome, to the point video.
@TheNickolayKanals
@TheNickolayKanals 2 жыл бұрын
U didn't learnt multithreading lol. This video didn't covered even 10% of information you need
@cobalt79R
@cobalt79R 2 жыл бұрын
@@TheNickolayKanals It covered enough to get me going and add up to it which in the end helped me land a job
@l1b3rator
@l1b3rator Жыл бұрын
@@cobalt79R There are a ton of other things, Concurrency API, synchronizing, using Monitors (Locking), using CyclicBarriers etc etc. I never worked in IT, i am just doing it for hobby, and i see that many people that worked in the industry know so few things about core Java ..... Is this the norm? can you really program in Java without knowing Java Core ?!? Multithreading is not used? or is it dealt with by frameworks ?
@chikipichi5280
@chikipichi5280 Жыл бұрын
Is multithreading not a normal thing needed in software engineering? I don't know much about the field.
@_.Prometheus._
@_.Prometheus._ Жыл бұрын
@@l1b3rator only few important stuff in java is required to create a working software. Like constructors are made by compiler so no need to impletment abstract constructors everytime. Same with destroying objects. Jvm takes careof it
@jjjbrke3888
@jjjbrke3888 Жыл бұрын
I have been looking for a basic, clear, organized, and practical explanation of multithread for a long time. John not only cut down to simple words, but his short explanation also met all my expectations. Kudos, John! What a way to simply otherwise obscure concepts.
@vishwaratna
@vishwaratna 2 жыл бұрын
Being a java developer myself I can vouch for John, a very clear explanation.
@arthursoave93
@arthursoave93 2 жыл бұрын
You have no idea how much you help me everyday. It's really easy to forget the basics and the fundamentals but watch your videos help me to keep on track with that. Thank you, John!
@AdrianTregoning
@AdrianTregoning 6 ай бұрын
I'm literally paying for a Java course and yet constantly find myself coming back to your videos John. So well explained. Perfect!
@2poreSnaxAir
@2poreSnaxAir 2 жыл бұрын
I am so glad KZfaq suggested this channel. All these videos are useful, direct to the point, and show great examples. It's difficult for me to learn the traditional way. I can't just read something and understand it. Thank you so much for what you're doing.
@PratikKumar42
@PratikKumar42 2 жыл бұрын
Please don't stop these series, it helps alot in learning.
@ravireddyism
@ravireddyism Жыл бұрын
Sambaar piyo aur sojaav
@asherkhan2656
@asherkhan2656 2 жыл бұрын
Though I am somewhat of an experienced developer, I felt I learned something new in this simple and sweet explanation of multithreading. Keep up the good work John
@thewildben3929
@thewildben3929 23 күн бұрын
wtf was that so easy to understand, literally one of the best turorials ive ever seen
@xskrish
@xskrish 2 жыл бұрын
this was SO well explained, I was scared of Java multithreading for such a long time until I came across this video! thanks a lot!
@Tuxon24rus
@Tuxon24rus 2 жыл бұрын
Hello, John! It is so inspiring to learn Java with you! I hope you'll make a video for thread safety, it's so challenging for me to understand the usage of synchronized keyword (especially what happens behind the scenes and how does it affect the data when a synchronized method calls unsynchronized one).
@pepp0tube
@pepp0tube 2 жыл бұрын
Hi John, I agree with Tuxon24rus: a video about synchronization would be really appreciated. Thank you!!
@keoniromano1479
@keoniromano1479 Жыл бұрын
this man literally teaches me even the basic stuff that no one else ever did and I love him for it
@Mukeshotwani
@Mukeshotwani 2 жыл бұрын
Great content John.
@ilovefood43cheese
@ilovefood43cheese Жыл бұрын
Great tutorial! The way you explain it is such a relief. Typically, people go into so much detail and forget to first just explain how it works. I mean, details are great and all, but put the basics first. You do that and it's great, thanks!
@prashantchauhan1573
@prashantchauhan1573 20 күн бұрын
The best explanation on KZfaq I have come across till now ...!!!!!!!! You rock John
@ichigo169_g7
@ichigo169_g7 2 жыл бұрын
I was planning on looking into this tomorrow and trying to implement it into my self study project. Much appreciated!
@adityagitte
@adityagitte Жыл бұрын
i can't thank you enough for this video! This is the shortest and the most concise video that i have seen on multi-threading, this is like a 40 page chapter in my book. Thank you!
@arrypandowo1546
@arrypandowo1546 11 ай бұрын
I just read a book for 3 hours and your explanation is way easier to understand to grasp the basic concept of multithreading, thank you so much, John, you are awesome
@johndrowned7170
@johndrowned7170 11 ай бұрын
This has been by far the most concise explanation of Multithreading I´ve ever seen.
@tichaonamiti4616
@tichaonamiti4616 Жыл бұрын
Simple and straight to the point..... you are the best
@newvemo
@newvemo 2 жыл бұрын
Thanks John, you're a genius, I was waiting for this as I requested, god bless you and keep it up helping people to reach their dreams on coding, Thanks
@awalehhoussein3099
@awalehhoussein3099 2 жыл бұрын
I was confused until now. Thanks a lot.
@MyzticBean
@MyzticBean 2 жыл бұрын
You are an absolute genius when it comes to explaining concepts in the simplest of terms. I really regret having found you so late in my life. Keep up the great work.. 👍
@davidhakobyan7270
@davidhakobyan7270 2 жыл бұрын
You are totally the person a lot of beginners need. I have 2 years experience but anyways watch your videos and still have things to learn. Thanks a lot!
@weinsim3856
@weinsim3856 2 жыл бұрын
These videos are so good. You do such a great job explaining thins in a way that really gets to the point and that makes it really enjoyable to watch. Great job, keep up the awesome work!
@therealtulip
@therealtulip Жыл бұрын
What a helpful video! Short, clear, and straight to the point. Thank you!
@kaedeumi2072
@kaedeumi2072 Жыл бұрын
A very straightforward and intuitive explanation that explains even better than my official lecture slides. Awesome!
@anpadjahil9711
@anpadjahil9711 2 жыл бұрын
Couldn't have been more simpler! Thanks a lot John!!
@MohammadYs77
@MohammadYs77 2 жыл бұрын
very easy to understand, short, and very useful. Thank you.
@akaDL
@akaDL 2 жыл бұрын
For years i've never understood mulththreading. Now in 10 minutes i fully understand. You really deserve a lot more.
@ShivangGulati
@ShivangGulati 7 ай бұрын
10 mins and this man saved hours of hopelessly running around on KZfaq watching confusing shit. Thankyou!
@unizfrhn2803
@unizfrhn2803 2 жыл бұрын
Holy Moly brother!!!!! Thanks so much for this tut. This taught me so many things and also in quick time than any of the freaking Professors in University. A life saver !!!! Hats off to you, sir.
@abhimanuwalia5755
@abhimanuwalia5755 Жыл бұрын
i could not imagine anyone could explain it better, Thank you
@whitingtennis4914
@whitingtennis4914 2 жыл бұрын
Incredibly clarifying - thanks!
@rxphi5382
@rxphi5382 Жыл бұрын
I love the fact that all your videos are indeed very "clear and understandable"❤
@vibhashreehippargi8233
@vibhashreehippargi8233 Жыл бұрын
Never understood it until i watched this tutorial. Just amazing! :)
@user-zu3mu9je9c
@user-zu3mu9je9c 4 ай бұрын
So glad, I found your channel. Everything is crystal clear
@gael6252
@gael6252 2 жыл бұрын
Amazing, I will start with Java next semester and I can already see several ways I could implement Threads on my oncoming assignments, keep doing this quality videos!
@monnishs9775
@monnishs9775 6 ай бұрын
Never understood this in my class but now i am very excited to use it in my programs, Thank you John.
@claudiograsso
@claudiograsso 2 жыл бұрын
Congrats!!! Straight to the point. No blah, blah, blah, Thanks a lot!!!
@D0Samp
@D0Samp 2 жыл бұрын
One more advantage of the Runnable interface besides extensibility is that you can reuse objects in new threads where it's useful, especially if they contain a significant amount of data. Thread objects are used up after they are done executing. Alternatively, Runnables also can be handed to an Executor to decouple them further from the thread that actually executes them.
@nahidanwar6719
@nahidanwar6719 Жыл бұрын
I just loved your explanation. So simple and easy
@Chakrabortykuntal
@Chakrabortykuntal 2 жыл бұрын
Really great video, I have never been so clear about how multithreading works . Thanks John.
@pravalkollipara9803
@pravalkollipara9803 2 жыл бұрын
Learned this concept in class and was very confused. This video explained it so much better, thanks!
@albertotroni3852
@albertotroni3852 3 ай бұрын
My teacher showed us your video in class, but i really didn't want to listen to the lesson. But now at home i watched the entire video and i find it really clear even if English is not my primary language and my coding skills are not the best. Huge thanks from Italy!!!
@pranitha1171
@pranitha1171 Жыл бұрын
Its 200% clear and your explanation is 500% understandable. I always follow you for every concept that i need. Please dont stop this channel.
@ManojKeerthy555
@ManojKeerthy555 Жыл бұрын
Thank you so much John! I have never felt so ease in understanding a topic(which btw takes years to understand). And also you are the first youtube channel which I have subscribed within the first 3 minutes of watching the video.
@SuperWaavy
@SuperWaavy 2 жыл бұрын
You explained in 10 minutes what my prof couldn't do in 4 hours. Thanks John
@joonMayer
@joonMayer Жыл бұрын
Had to pause in the middle of the video to comment about how good this video is!!!!!!! Such great content
@mklcrsh
@mklcrsh 2 жыл бұрын
So clear, thank you for this video. Can’t wait to start a project with multi threading!
@bsmanjunath8323
@bsmanjunath8323 2 жыл бұрын
Thanks a lot for this. A friend of mine shared this video. This helped me a lot to understand the simple concepts of threads and was able to implement the same in the project. Thanks John
@tysontakayushi8394
@tysontakayushi8394 Жыл бұрын
Beautiful explained! I watched it some months ago and I wasn't able to understand it. I gave it some time and now everything sounds clear and simple.
@swapnalipatil5019
@swapnalipatil5019 Жыл бұрын
Best Java related videos I have ever come across.
@newton94
@newton94 2 жыл бұрын
Great tutorial, I am total noob in Java but everything you just said was easy to understand and fun to watch.
@danieltokai3853
@danieltokai3853 2 жыл бұрын
Great pacing, explanation, and visuals!
@snoopy1alpha
@snoopy1alpha 2 жыл бұрын
Nice overview of the principals however, there are many aspects that demand one or more follow-up videos on this topic: - How to work with threads that use an infinite loop (interrupt mechanic...) - How to write thread-safe code (synchronize mechanic...) - Wait and notify inside of synchronize-blocks - How to transport an exception that occurs on a thread to the main thread (is there actually a build-in mechanic?) - Future objects - Multi-Threading in Swing (Event dispatch thread and how not to use it ... SwingWorker) - Parallel Streams (findAny vs. findFirst) One point that could have been demonstrated in a better way in this video: You could have created an array (or list) of threads and call the join method in a separate loop after all threads have been started, followed by some code that is run after all threads have finished. That way you could have shown a use case where you separate a complex computation in multiple threads and collect the results after all of them have finished.
@PowerStudios1000
@PowerStudios1000 2 жыл бұрын
Dont forget thread pools
@nicholaswood3250
@nicholaswood3250 Жыл бұрын
This is why threading is such a hard concept to tech concisely. It’s literally a topic that people have based their careers on because there are so many little details to understand.
@jannabil6800
@jannabil6800 3 ай бұрын
very simple and detailed explanation thanks a lot John
@andersongalvao7550
@andersongalvao7550 2 жыл бұрын
I'm going to try that out as soon as possible. I'm really pumped!
@jerin8121
@jerin8121 2 жыл бұрын
Thank you so much for making everything simpler.
@misterdneh
@misterdneh 2 жыл бұрын
This explains a lot more now, definitely helped ease my brain on the level of Threading
@ezekielthemack
@ezekielthemack 2 жыл бұрын
Thanks for your help John in explaining this rather complex (I think) subject matter. You explained it very clearly and concisely. Much appreciated.
@iancesarvidinharego9601
@iancesarvidinharego9601 8 ай бұрын
Your way to learn is FANTASTIC!
@mahmoudbaddary7596
@mahmoudbaddary7596 6 ай бұрын
You are the best one I've seen explains java, really thank you
@NabilIbrahim-nm7kz
@NabilIbrahim-nm7kz Жыл бұрын
Great lectures john totally helping me push forward
@sitanshukirtivardhan5877
@sitanshukirtivardhan5877 Жыл бұрын
Amazing video.. solved my doubts in minutes.. love from India !!
@sp3ctrums264
@sp3ctrums264 2 жыл бұрын
Clear and straight forward explanation. Very helpful
@akilavenkatachalam9916
@akilavenkatachalam9916 2 жыл бұрын
Great thanks John.. Really appreciate your work to make other understand clear... Thanks a lot..
@Guillen8606
@Guillen8606 Жыл бұрын
If I ever have a doubt I just come to this channel. Thanks for the great and simple explanations John
@rafaelwu
@rafaelwu 2 жыл бұрын
I'm so glad that I found your videos
@chipotle555
@chipotle555 11 ай бұрын
Best video! So simple and precise, best video on multithreading found so far!
@pridurok4228
@pridurok4228 2 жыл бұрын
Very informative and comparably short video, Thank you very much.
@abdulazeez180
@abdulazeez180 2 жыл бұрын
You have no idea how much you have helped me ! Thank you , keep up the great work !
@subhampaul8351
@subhampaul8351 2 жыл бұрын
Explained so easily. I just want to say thank you for all your videos.
@trevornkuna8391
@trevornkuna8391 Жыл бұрын
Thorough and straight forward explanation 💫💫
@bahaalebda41
@bahaalebda41 2 жыл бұрын
Very Helpful Explanation! Thanks a lot
@THESJS
@THESJS 7 ай бұрын
such a good explanation now i must figure out if i need to use it in my project and where
@mohamad.golshani
@mohamad.golshani Жыл бұрын
Wow! John i wish you had an idea about how much your explanations seems clear and understandable to me. World class stuff!
@Krazness
@Krazness 2 жыл бұрын
Excellently explained. Thanks man
@knochenmarc117
@knochenmarc117 2 жыл бұрын
I just recently stumbled across this channel and easy one of the, if not the best, coding channel. The way you explain this stuff is so nice and easy to follow. Hell I even watch it during my free time for fun. Never experienced that before with Coding Tutorials.
@Nat-qm5vb
@Nat-qm5vb 7 ай бұрын
Videos like this get me through grad school. Thanks, John!
@urnotSylvia
@urnotSylvia Жыл бұрын
Thank you John! Clearly explained!
@simbac
@simbac 2 ай бұрын
These explanations are so exceptional!
@metall7331
@metall7331 Жыл бұрын
Beatiful explanation. I've taken college courses and read programming books but none of them explained it as eloquently as this. Thank you for making this video! 😊
@karthiks1765
@karthiks1765 11 ай бұрын
This man has rekindled my long dead love for Java. What a teacher. Respect. ✊
@miishaaq1088
@miishaaq1088 2 жыл бұрын
Thank you so much John for such marvellous explanation clearing all doubts within no time
@ryanhill1505
@ryanhill1505 Жыл бұрын
These videos are a delightful introduction to the language. I'm a seasoned Go developer moving into Java. I've been sad about that transition, as Go is so elegant and lightweight. Java seems big, bulky, and complicated by comparison. But John! You're quickly cheering me up. Your attitude is infectious, you naturally bring out Java's own elegant design, and you indirectly answer several other questions for each one you address head-on. For instance, in this one, I see that a Java thread is dedicated to a runnable, and that exceptions on a spawned thread - even runtime ones - do not, by default, bubble up out of that thread's context into the main one. Thank you!
@meduriravindra4238
@meduriravindra4238 2 жыл бұрын
Please explain more concepts that really help in real time. It’s really great learning from an experienced guy like you. Thanks a lot.
@khurrambhatti9470
@khurrambhatti9470 9 ай бұрын
Beautifully explained.
@sususu9
@sususu9 Жыл бұрын
wonderful explanation! Thank you John
@csanid1
@csanid1 7 ай бұрын
that was a super clear explanation, thank you!
@Play_Streams
@Play_Streams 2 жыл бұрын
Simple & concise. Thanks John!
@user-nh1ww1iw5e
@user-nh1ww1iw5e 11 ай бұрын
Great explanation John, Thank you very much!
@FaisalAmin001
@FaisalAmin001 Жыл бұрын
wow, so clear and straight forward , thank you
@davisoares26
@davisoares26 2 жыл бұрын
Man, what an explanation! I was going crazy with this multithreads in java... Thank you very much!!
@_inhCaoToan
@_inhCaoToan Жыл бұрын
very easy to understand you are a good dev with good explaination
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1 МЛН
Java multithreading 🧶
15:18
Bro Code
Рет қаралды 120 М.
Black Magic 🪄 by Petkit Pura Max #cat #cats
00:38
Sonyakisa8 TT
Рет қаралды 40 МЛН
Они убрались очень быстро!
00:40
Аришнев
Рет қаралды 2,3 МЛН
FANG Interview Question | Process vs Thread
3:51
ByteByteGo
Рет қаралды 277 М.
Exception Handling in Java Tutorial
13:20
Coding with John
Рет қаралды 358 М.
Lambda Expressions in Java - Full Simple Tutorial
13:05
Coding with John
Рет қаралды 701 М.
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
11:43
Coding with John
Рет қаралды 571 М.
Java Polymorphism Fully Explained In 7 Minutes
7:16
Coding with John
Рет қаралды 291 М.
#86 Multiple Threads in Java
11:30
Telusko
Рет қаралды 97 М.
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 602 М.