Multithreading in Java Explained in 10 Minutes

Поділитися
Вставка
  • Опубліковано 23 гру 2024

КОМЕНТАРІ • 898

  • @69k_gold
    @69k_gold 2 роки тому +300

    Used multithreading to create 5 Google accounts at the same time to like this video 5 times

    • @Shhhhivam
      @Shhhhivam 8 місяців тому +15

      And that’s exactly what multithreading is not meant to be used

    • @jodathassan8894
      @jodathassan8894 6 місяців тому +2

      Omg really?????

    • @HMOsman-ml9qp
      @HMOsman-ml9qp 5 місяців тому +1

      LOL! running 5 Google account in your machine at a time can be called multi tasking or somehow multithreading... Not creating 5 Google account!

    • @DSASimplified-zs6ll
      @DSASimplified-zs6ll 2 дні тому

      What a joke he crack🥳

  • @euroticker4828
    @euroticker4828 3 роки тому +1710

    Literally explains more than my Professor does in 6 hours, God bless you John.

    • @sin_alpha3373
      @sin_alpha3373 3 роки тому +38

      Bcs he uses human language

    • @barbe7818
      @barbe7818 3 роки тому +18

      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 3 роки тому +9

      Wait, multi threading is covered in uni?

    • @richskater
      @richskater 2 роки тому +6

      @@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 роки тому +2

      @@richskater sounds like ez degree

  • @ShivangGulati
    @ShivangGulati Рік тому +12

    10 mins and this man saved hours of hopelessly running around on UA-cam watching confusing shit. Thankyou!

  • @keoniromano1479
    @keoniromano1479 Рік тому +345

    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.

  • @pt_trainer9244
    @pt_trainer9244 3 роки тому +413

    Don't know why this doesn't have more views. Very clear and straight to the point explanation. Thank you =)

  • @sianwa11
    @sianwa11 Рік тому +13

    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!

  • @PratikKumar42
    @PratikKumar42 2 роки тому +20

    Please don't stop these series, it helps alot in learning.

  • @alby3917
    @alby3917 10 місяців тому +1

    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!!!

  • @jjjbrke3888
    @jjjbrke3888 2 роки тому +10

    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.

    • @Sakrosankt-Bierstube
      @Sakrosankt-Bierstube Місяць тому

      You have to keep looking than. Because he is missing like 99% of the information related tu multithreading.

  • @arrypandowo1546
    @arrypandowo1546 Рік тому +2

    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

  • @kraxmalism
    @kraxmalism День тому

    I have been struggling with java in my late 30s (I am stubborn - I will make it all by myself) with help of online tutorials and mostly books. But each time i start a new complicated (or rather complex) topic - i watch John's video on youtube, get the idea, and then proceed with 5-6 hours tutorial on the same topic. Otherwise, sometimes it is really difficult to understand what is going on. Thanks Johnny for such great videos. Kudos from Azerbaijan!

  • @asherkhan2656
    @asherkhan2656 2 роки тому +21

    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

  • @AdrianTregoning
    @AdrianTregoning Рік тому +2

    I'm literally paying for a Java course and yet constantly find myself coming back to your videos John. So well explained. Perfect!

  • @sushantparekar3687
    @sushantparekar3687 Рік тому +1

    UA-cam is something which I learnt more than any college
    I prepared gate did well from UA-cam
    Even apti for campuss interview
    My frnd got 8000 rank in JEE mains from UA-cam it's blessing for this era
    Thanks prof jhon

  • @WilliamLiu-e4u
    @WilliamLiu-e4u Рік тому +3

    best cs teacher ever i love john

  • @arthursoave93
    @arthursoave93 2 роки тому +15

    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!

  • @keoniromano1479
    @keoniromano1479 Рік тому +1

    this man literally teaches me even the basic stuff that no one else ever did and I love him for it

  • @vishwaratna
    @vishwaratna 3 роки тому +100

    Being a java developer myself I can vouch for John, a very clear explanation.

  • @thewildben3929
    @thewildben3929 7 місяців тому +1

    wtf was that so easy to understand, literally one of the best turorials ive ever seen

  • @Ruyk-u4d
    @Ruyk-u4d 3 місяці тому

    wow... In just 10 min I learned what I had put off for years because I thought its too complicated and its for seniors. BIG SHOUTOUT to this guy!

  • @johndrowned7170
    @johndrowned7170 Рік тому

    This has been by far the most concise explanation of Multithreading I´ve ever seen.

  • @cobalt79R
    @cobalt79R 2 роки тому +198

    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 роки тому +11

      U didn't learnt multithreading lol. This video didn't covered even 10% of information you need

    • @cobalt79R
      @cobalt79R 2 роки тому +24

      @@TheNickolayKanals It covered enough to get me going and add up to it which in the end helped me land a job

    • @l1b3rator
      @l1b3rator 2 роки тому +5

      @@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 2 роки тому +1

      Is multithreading not a normal thing needed in software engineering? I don't know much about the field.

    • @_.Prometheus._
      @_.Prometheus._ 2 роки тому +2

      @@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

  • @akaDL
    @akaDL 2 роки тому

    For years i've never understood mulththreading. Now in 10 minutes i fully understand. You really deserve a lot more.

  • @gizelealves9888
    @gizelealves9888 3 роки тому +1

    You made me understand in 10 minutes what my teacher didn't do in two hours. And I don't even speak English. So, thank you for that.

  • @naveenkumars8570
    @naveenkumars8570 2 роки тому

    4 hours i took to learn Multithreading and you just did in 10 minutes, Thank You.

  • @MsPocketMonsters
    @MsPocketMonsters 2 роки тому

    I saw a 20 minutes video of a guy doing a Thread. This guy used run. He used fkn run, and there I was, wondering what's the purpose of threads if my program had to stop execution after running the Thread. You are an amazing teacher.

  • @xskrish
    @xskrish 2 роки тому +7

    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!

  • @prashantchauhan1573
    @prashantchauhan1573 7 місяців тому

    The best explanation on UA-cam I have come across till now ...!!!!!!!! You rock John

  • @mohamedbilal5634
    @mohamedbilal5634 Рік тому

    The intro goes like "And i love sharing what i've learnt in a clear understandable way" - Every word of this is true 👌

  • @unizfrhn2803
    @unizfrhn2803 2 роки тому +3

    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.

  • @NikhilSingh-ei2ft
    @NikhilSingh-ei2ft 5 місяців тому

    Its always delightful to see an instructor who enjoys teaching the topic so much

  • @Mukeshotwani
    @Mukeshotwani 2 роки тому +19

    Great content John.

  • @frustratedcommenter4018
    @frustratedcommenter4018 Рік тому

    i'm trying to understand this concept for past three day and tried so many turtorials but you explained in just 10 minutes thanks a lot

  • @zoetorres1894
    @zoetorres1894 7 місяців тому

    When I started Java a few years ago it was truly hard, much harder than C was for me at that moment. After taking OOP with a crazy as hell college prof, Java truly grew on me, I learnt a lot, and from you I'm also learning much more

  • @joonMayer
    @joonMayer Рік тому

    Had to pause in the middle of the video to comment about how good this video is!!!!!!! Such great content

  • @amanwehib8367
    @amanwehib8367 Рік тому

    When a person speaks fast, my attention is totally absorbed. Excellent explanation with fluency, articulation, and eloquence!!!

  • @oswaldohernandez8476
    @oswaldohernandez8476 Рік тому

    I am not a native English speaker and I could understand you very well. This is an excellent video, It's very clear and understandable. Thanks a lot.

  • @Tuxon24rus
    @Tuxon24rus 3 роки тому +44

    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 роки тому +2

      Hi John, I agree with Tuxon24rus: a video about synchronization would be really appreciated. Thank you!!

  • @fullmetaltheorist
    @fullmetaltheorist 6 місяців тому

    This is literally the best explanation on UA-cam.

  • @shadeismael7460
    @shadeismael7460 Рік тому

    3 hours lecture and i didn't understand anything , john in 10 minutes i understood everything , you da best

  • @babhijit
    @babhijit Рік тому +1

    Great content. Make some videos on SOLID principles and Design Patterns.

  • @loveleen8808
    @loveleen8808 Рік тому

    You made me understand in 10 mins what my professor couldn’t in a 2 hr lecture

  • @julianerodriguesdesouza7738
    @julianerodriguesdesouza7738 2 роки тому +1

    saved my ass at university today. explains better than my professor! Thank you so much for this video!

  • @SuperWaavy
    @SuperWaavy 3 роки тому

    You explained in 10 minutes what my prof couldn't do in 4 hours. Thanks John

  • @justinmeskan4410
    @justinmeskan4410 2 роки тому

    great video, I just came from Udemy and this 10-minute vid blew that whole course outta the water. Props...

  • @davidhakobyan7270
    @davidhakobyan7270 3 роки тому +1

    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!

  • @snoopy1alpha
    @snoopy1alpha 2 роки тому +41

    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 роки тому +1

      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.

  • @saswat23
    @saswat23 Рік тому

    Short, clear and precise. That's how teaching should be.

  • @karthiks1765
    @karthiks1765 Рік тому

    This man has rekindled my long dead love for Java. What a teacher. Respect. ✊

  • @D0Samp
    @D0Samp 2 роки тому +4

    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.

  • @claudiograsso
    @claudiograsso 3 роки тому

    Congrats!!! Straight to the point. No blah, blah, blah, Thanks a lot!!!

  • @2poreSnaxAir
    @2poreSnaxAir 2 роки тому +3

    I am so glad UA-cam 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.

  • @nepnep1057
    @nepnep1057 2 роки тому +1

    In case anyone watching this doesn't like creating a separate class for multithreading, another option (available in java 8 or higher) is to use a lambda expression, since Runnable is an interface with a single abstract method, if you use a lambda expression the compiler will create the class for you, the syntax is () -> System.out.println("Lambda") passed as an argument for example, it can also be used with interfaces that have a method with different parameters, where you put them between the parenthesis, and you can even return a value

  • @TinyFaraday
    @TinyFaraday 2 роки тому

    Turned 4 hours of trying to study my lecture notes into doing my project in 30 min, thank you John!

  • @minecraftsooogeil
    @minecraftsooogeil 2 роки тому

    well.. even my english isnt the best.
    You explained better then my teacher in 90mins.
    Thanks alot!

  • @chunder64
    @chunder64 8 місяців тому

    This is the BEST explanation I have seen! Thank You!! There is one caveat and that is this is the high level view. The low level view is that, depending on the platform, it may not be happening at the exact same time.

  • @pranitha1171
    @pranitha1171 2 роки тому

    Its 200% clear and your explanation is 500% understandable. I always follow you for every concept that i need. Please dont stop this channel.

  • @monnishs9775
    @monnishs9775 Рік тому

    Never understood this in my class but now i am very excited to use it in my programs, Thank you John.

  • @otabektoychiboyev513
    @otabektoychiboyev513 Рік тому +1

    fantastic, that 10 minutes is more valuable than my 3 hour lecture.

  • @MyzticBean
    @MyzticBean 2 роки тому +3

    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.. 👍

  • @nivethak7326
    @nivethak7326 3 роки тому

    In 10 mins if you want to learn any concept clearly ,then this channel is the best..❤️❤️

  • @abhimanuwalia5755
    @abhimanuwalia5755 Рік тому

    i could not imagine anyone could explain it better, Thank you

  • @swapnalipatil5019
    @swapnalipatil5019 2 роки тому

    Best Java related videos I have ever come across.

  • @Megatr0n12
    @Megatr0n12 Рік тому +1

    Would love to hear you explain things in more details, such as how the internals work for Threads, Heap memory, Stack memory, use of the Volatile keyword, avoiding race conditions on shared resources when working in a multithreaded program : )

    • @CodingWithJohn
      @CodingWithJohn  Рік тому +1

      Thanks so much! That's some advanced stuff, but I'm hoping to get to all of it!

  • @吕沅昊
    @吕沅昊 2 роки тому

    this dude's explanation is on a whole other level

  • @ryanhill1505
    @ryanhill1505 2 роки тому +1

    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!

  • @awalehhoussein3099
    @awalehhoussein3099 2 роки тому

    I was confused until now. Thanks a lot.

  • @info-prog
    @info-prog 2 роки тому

    Hi Jhon, you talk fast, but i can tell that i've reported all the code in the video, and it works perfectly, especially when i introduce start command, sometimes i have in the same run session different thread order execution....thant you so much Jhon.

  • @aksharjoshi3384
    @aksharjoshi3384 3 роки тому

    I was struggling and pulling my hair over this. I love you. Now I understand why threads are important in the first place. Knowing their purpose has made it easier for me to understand them.

  • @vibhashreehippargi8233
    @vibhashreehippargi8233 2 роки тому

    Never understood it until i watched this tutorial. Just amazing! :)

  • @siniravindran6956
    @siniravindran6956 Рік тому

    Thank you so much. This entire day I was trying to find some issue with the code that I have written on multiple threading. Just before bed saw this video and I am not sure if the issue would b solved but I think I got it. You explained this in a simple way . Literally as the title says in 10 minutes. Thanks again

  • @tlukend
    @tlukend 2 роки тому

    amazing! 10 mins with John > 4 hours at Uni
    thank you!!

  • @newton94
    @newton94 3 роки тому +1

    Great tutorial, I am total noob in Java but everything you just said was easy to understand and fun to watch.

  • @droidlycodes
    @droidlycodes 2 роки тому +2

    This explains a lot more now, definitely helped ease my brain on the level of Threading

  • @virajajani9819
    @virajajani9819 2 роки тому

    When you told about runnable interface I paused the video and was thinking that then why it is different from Thread class and when I continued I got my answer. Only a real teacher can do this thing

  • @lowkee9731
    @lowkee9731 Рік тому

    Dear Master I'll be here for 3years ,thank you so far 👏👏 you nail everything so far,and your goal we are here so it is reached already 👑

  • @flash.legend3781
    @flash.legend3781 2 роки тому

    John, I have been following your Java course videos for quite a while now. They are good and helpfull.
    I have a request/suggestion for you, have you ever thought of making videos on the interview questions(say 100 questions on core Java, 100 on advanced Java, something like that may be more or less ). If at all, if you want look into preparing these videos take the points below into consideration please.
    1) These videos are for the people who know Java already and they watching to fine tune themselves to understand the interviewer expectations and crack the interview.
    2) Saying only once no repetitions in the video at any cost. To the point, precise, concise. If the viewers want to watch again they go back and replay always. Repetition will be pretty boring for the people who watch with full attention and concentration,.
    3) Slow and average speed of the flow of the video, is what I would suggest. Of course viewer can change but by default if you can make it of that way it would be good.
    Thanks.

  • @entertainwill4917
    @entertainwill4917 11 місяців тому

    Such a helpful video for a Java novice like me, I'm so glad I stumbled upon it while eating dinner. 😄

  • @justalilbit8887
    @justalilbit8887 2 роки тому

    Why are you so good at explaining these things?

  • @Guillen8606
    @Guillen8606 2 роки тому

    If I ever have a doubt I just come to this channel. Thanks for the great and simple explanations John

  • @iancesarvidinharego9601
    @iancesarvidinharego9601 Рік тому

    Your way to learn is FANTASTIC!

  • @swastikapaul371
    @swastikapaul371 Рік тому

    This is the first time i was learning multithreading and damn he made it so easyyyy.

  • @fernoveonelest9038
    @fernoveonelest9038 3 роки тому +1

    Severely underrated channel. You deserve more subs!!

  • @fardinshah7357
    @fardinshah7357 3 роки тому

    Thank you man!! Thank you !!!!! Thank you !!!!! Thank you !!!!! Thank you !!!!! You just literally explained what my teacher tried to explained in 1 month. Please continue this series. There are not many good lecture .

  • @shashe42
    @shashe42 Рік тому

    I'm interacting just to feed the algo but I learned something in at least one other video of yours as well, so I subscribed as well. I feel like I'm going to binge a lot of your videos over the coming months. Your video editing and script planning is on a similar level to your Java knowledge. which is high praise for all of the above..

  • @ulyses1018
    @ulyses1018 2 роки тому

    It is a very example, I don't know nothing about Multithreading and now I feel more comfortable with this topic. Thank you John. One additional comment is, can you explain in a real programming scenario what can be the porpuse of Multithreading ?

  • @hansmalm2801
    @hansmalm2801 3 місяці тому

    This is GOLD. GOLD I tell you. I will destroy my university course.

  • @Stl71
    @Stl71 3 роки тому

    Some people say that Java is outdated, but I still use it. It's a beautiful language, I think.

  • @TimurBelekov-p6l
    @TimurBelekov-p6l 10 місяців тому

    So glad, I found your channel. Everything is crystal clear

  • @Nat-qm5vb
    @Nat-qm5vb Рік тому

    Videos like this get me through grad school. Thanks, John!

  • @tysontakayushi8394
    @tysontakayushi8394 2 роки тому

    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.

  • @rxphi5382
    @rxphi5382 Рік тому +1

    I love the fact that all your videos are indeed very "clear and understandable"❤

  • @pravalkollipara9803
    @pravalkollipara9803 2 роки тому

    Learned this concept in class and was very confused. This video explained it so much better, thanks!

  • @이지-b9k
    @이지-b9k 6 місяців тому

    Thx u for multithreading teach. Before a few hours, I didn't understand that
    but now I watching this video, I totally understand that. this is slayyyyy!!

  • @johncpope
    @johncpope 2 роки тому

    The Good: You were clear on a technical topic. The Bad: You ran through it rather quickly. I'm having trouble using the second method you described. Could you make another threading video that focuses on implementing the runnable interface and that shows how someone can run multiple threads that are not the same thread? Does input/output work in multiple threads?

  • @newvemo
    @newvemo 3 роки тому +13

    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

  • @tichaonamiti4616
    @tichaonamiti4616 2 роки тому

    Simple and straight to the point..... you are the best

  • @azuraflame1
    @azuraflame1 Рік тому

    You have a gift for teaching that few people have this is a great video its concise, effective, covers the the basics in an easy to digest manner. thanks for the video it really helped.

  • @TechMegz
    @TechMegz 8 місяців тому

    Wow!!!! Just wow!!! Amazed by the way he teaches, so quick, efficient and effective.

  • @sp3ctrums264
    @sp3ctrums264 2 роки тому

    Clear and straight forward explanation. Very helpful