13.5 MultiThreading join and isAlive method in Java

Поделиться
HTML-код
  • Опубликовано: 15 ноя 2024

Комментарии • 48

  • @mywebsite6524
    @mywebsite6524 4 года назад +1

    I am from Bangladesh..Nothing to say..But you are awesome LEGEND...........

  • @shashankmarri1056
    @shashankmarri1056 8 месяцев назад

    Either t1.join() or t2.join() is sufficient. The thread from which join is called (ie. the main thread in this example), will exclude itself from executing until the other threads complete and joins them at the end.

  • @likithr.n9692
    @likithr.n9692 Год назад

    t1.Alive() and t2.Alive is called in the main thread,
    So the correct explanation is the main thread will wait for both t1 and t2 thread to complete its execution only after which it will print "bye".

  • @abhimalvekr127
    @abhimalvekr127 5 лет назад +36

    1:55 I can sense the stare :P

  • @小江-j1i
    @小江-j1i 2 года назад +4

    So the meaning of "join" is t1 and t2 will join back main thread after they finish their own thread. So main thread has to wait for their join.

  • @zeeshanalamgir5053
    @zeeshanalamgir5053 6 лет назад +1

    sir i inspired on u very good tutorials i learned new day by day thank u ...

  • @ferfykins
    @ferfykins 3 года назад

    Awesome video!! I never understood till watching this :)

  • @harshsegyan
    @harshsegyan 5 дней назад

    We r in ur support

  • @riderprovider6213
    @riderprovider6213 5 месяцев назад

    Lovely explanation.

  • @calebolojo5246
    @calebolojo5246 7 лет назад +1

    Great Great Tutorial!
    Please can you Number/ Identify your videos sequentially. Like = "MULTI-THREADING PART 1" , "MULTI-THREADING PART 2", "MULTI-THREADING PART 3" and so on... So we can follow your lesson properly and not jump. THanks

  • @adiletbolatbek7679
    @adiletbolatbek7679 5 лет назад +4

    Your accent is awesome!!!

  • @satyaprakashtiwari477
    @satyaprakashtiwari477 6 лет назад +1

    I think only one join() either in Thread1 or Thread2 is enough to join other thread.
    Correct me if I am wrong.

  • @pallavi4501
    @pallavi4501 7 лет назад +1

    Hey very nice video. I'm big fan of you now. keep up the good work

  • @shivakumar-hh7me
    @shivakumar-hh7me 3 года назад

    can we get live java classes freely?

  • @MalalaValala
    @MalalaValala Год назад

    Like From Uzbekistan 🇺🇿🇺🇿🇺🇿🇺🇿🇺🇿🇺🇿

  • @avegeta1
    @avegeta1 7 лет назад

    Please make a video on Atomic operations for Multithreading! Thanks

  • @BaduguPranay
    @BaduguPranay 6 лет назад

    you can also use finally

  • @nischalofchrist
    @nischalofchrist 2 года назад

    Very helpful Thank You

  • @mukhtarali5457
    @mukhtarali5457 6 лет назад +1

    Helli sir i have a problem in this example join and isalive method not working and not taking the output is same as example please answer

    • @sivaganesh4489
      @sivaganesh4489 4 года назад

      Same here if u sort out it please ping me

  • @surendars8916
    @surendars8916 4 года назад

    Hi Sir, here we have throws exception .but not handled with try catch.since it is runtime exception we can do so?
    Please reply

  • @flyingbirds4235
    @flyingbirds4235 6 лет назад

    Great explanation.

  • @damanpreetsingh8549
    @damanpreetsingh8549 5 лет назад

    It does not work with THREAD CLASS by implementation of run method why ? I wrote same code using Thread class it is not executing why ??

  • @omprakashkatre2997
    @omprakashkatre2997 5 лет назад

    You haven't written extend thread

  • @VictorNolochemical
    @VictorNolochemical 6 лет назад

    Hey quick question, can you describe .join is this a blocking/non-blocking in regards to the UI thread? Great video thank you :)

  • @chsrinivasarao9538
    @chsrinivasarao9538 2 года назад

    This is an good video!

  • @javascriptwar9525
    @javascriptwar9525 6 лет назад

    sir what will be happen if t1 is not called join but t2 is called join..

    • @TheHooy
      @TheHooy 6 лет назад +2

      A bit too late, but maybe someone else also asks this question. Not an expert but i think: t2.join() forces other work to wait for it completion. In this scenario: t1.start();t2.start();t2.join();otherWork(); -> t1 and t2 will be executed parallelly and otherWork() waits for t2.
      Scenario 2: t2.start();t2.join();t1.start();otherWork(); -> Both, t1 and otherWork(), will have to wait until t2 is finished.

  • @anikeatbansal6916
    @anikeatbansal6916 7 лет назад

    why we are using throws exception with join()
    And what kind of exception will be?

  • @AdmirableShift
    @AdmirableShift 4 года назад

    What if we simply print Bye after ending the scope of thread

    • @bittooaggarwal5776
      @bittooaggarwal5776 3 года назад

      but the scope the threads here is the main methods itself?

  • @techie5345
    @techie5345 5 лет назад

    Thread t1= new Thread(()->
    Thread(()->
    When we write "()->" whats this?
    Is it same as -
    new Thread(new Runnable(){
    });

    • @nabujjalnath8219
      @nabujjalnath8219 5 лет назад +1

      read about lamda expression

    • @techie5345
      @techie5345 5 лет назад

      @@nabujjalnath8219 ok bro thanks

    • @manikandand2541
      @manikandand2541 4 года назад

      this is the concept of lambda expression

    • @Nishantt715
      @Nishantt715 4 года назад

      @@manikandand2541 woahh ok got it
      Thankyou bro

  • @sambittarai3
    @sambittarai3 7 лет назад

    instead of join(), why can't we use finally keyword there?

    • @vickyredwon
      @vickyredwon 7 лет назад

      yeah even I thought same when I watched this video

    • @aslam-kg4xo
      @aslam-kg4xo 3 года назад

      think about it... if you are going to place the "bye"(main thread) in finally, you can either place it in the finally block of thread *t1* OR *t2* . Say u place it the finally block of *t1* . So if *t1* finishes its task then it will execute the "bye". it wont bother if *t2* have completed or not and it will print bye. incase the *t2* havent completed, then "bye" wont be printed at last, instead it will be printed in between. so to avoid this. its better to wait for both the threads to finish

  • @ujjalsinha9106
    @ujjalsinha9106 6 лет назад

    nice video

  • @mohanphanindrareddygudimet5860
    @mohanphanindrareddygudimet5860 6 лет назад

    if we write join for only one thread also its working, i mean bye is printing at the end only. t1.join();

    • @sanketg1515
      @sanketg1515 5 лет назад +1

      Try to increase the for loop of t2 or you can decrease sleep time of t1... Try out....

    • @ProgrammerCpp1999
      @ProgrammerCpp1999 5 лет назад

      Why it is happening?? With only t1. join()

  • @ravisamani123
    @ravisamani123 5 лет назад +2

    1:56 some kids voice :)
    @Telukso

  • @AhmedAAA681
    @AhmedAAA681 2 месяца назад

  • @abufaya4155
    @abufaya4155 5 лет назад

    won't u read comments bud!!