Тёмный

Java Multithreading Interview Questions and Answers || Daemon Thread in java || Part 2 (Live Demo) 

Code Decode
Подписаться 129 тыс.
Просмотров 74 тыс.
50% 1

In this video of code decode, you will learn Multithreading Interview Questions and Answers in Java which is important in Java Interview Questions and Answers
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/udemycourse
Course Description Video :
yt.openinapp.co/dmjvd
Multi threading Interview questions part 1
• Most Asked Multithread...
Q) Difference between t.start() and t.run()
In the case of t.start() a new Thread will be created which is responsible for the execution of run() method.
But in the case of t.run() no new Thread will be created and run() method will be executed just like a normal method by the main Thread.
In the above program if we are replacing t.start() with t.run() the following is the output. Entire output produced by only main Thread. So Its sequential output always. First child then main / parent
Q) How to make a user thread to a Daemon thread
make a user thread to Daemon by using setDaemon() method of thread class.
This method is used for making a user thread to Daemon thread or vice versa. For example if I have a user thread t then t.setDaemon(true) would make it Daemon thread. On the other hand if I have a Daemon thread td then by calling td.setDaemon(false) would make it normal thread(user thread/non-daemon thread).
public boolean isDaemon(): This method is used for checking the status of a thread. It returns true if the thread is Daemon else it returns false.
setDaemon() method can only be called before starting the thread. This method would throw IllegalThreadStateException if you call this method after Thread.start() method. (refer the example)
The main difference between Daemon thread and user threads is that the JVM does not wait for Daemon thread before exiting while it waits for user threads, it does not exit until unless all the user threads finish their execution.
Q) What are the tasks of start method
Register the Thread with thread scheduler. So you just tell what a child thread should do, when and how it will be scheduled will be handled by scheduler.
Call run method.
Q) What if we don’t override Run method?
Thread class Run method will be called and we won’t get any output.
It’s basically useless as you are saying, please create a thread for me and that thread will do nothing for us. So why did u create it ?
Q) Can we overload run method during multi threading?
How do we overload?
May be by passing parameters?
Yes you can but start () will call no arg run () only.
Q) Can we override start method of thread in multi threaded environment?
If you override start () in your custom class then no initializations will be done by thread class for you.
Q) What is Multi threading & how is it diff from multi tasking asked In java interview question and Answers
Multithreading is a specialized form of multitasking.
Process-based multitasking is executing several tasks simultaneously where each task is a separate independent process is Process-based multitasking .
For example, process based multitasking enables you to run the Java IDE at the same time that you are using a text editor or visiting a web site using chrome.
Thread-based multitasking is executing several tasks simultaneously where each task is a separate independent part of the same program (called Thread).
For instance,JUnit uses threads to run test cases in parallel. As an application, you can have computer games. You see objects in games like cars, motor bikes etc. They are just threads that run in the game application.
Thus, process-based multitasking deals with the “big picture,” and thread-based multitasking handles the details
----------------------------------------------------------------------------------------------------------------------------------------
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
GIT : • GIT
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
Subscriber Code Decode : ru-vid.com?...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
#javainterviewquestions #multithreadinginterviewquestions #codedecode

Опубликовано:

 

17 май 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 172   
@CodeDecode
@CodeDecode 3 года назад
Hey guys, as per the request we have tried to reduce the pace. if it's fine just let us know else from next video shall we continue with the existing (a bit faster) pace ?
@shivamrai2889
@shivamrai2889 Год назад
Hello ma'am , Can you cover threadpool ?
@sagarmane3281
@sagarmane3281 Год назад
please cover Executor framework also
@rohansri
@rohansri Год назад
Hey
@rohansri
@rohansri Год назад
You haven't covered executor service methods , Race conditions and Multithreading concepts like isAlive,Startprocess,MaxProcess ,Pool Window and all . These questions you have covered they will ask from. freshers only not experieneced candidates.
@ashwinibarge9234
@ashwinibarge9234 Год назад
Please make video on Executor framework.
@nandakumarb7696
@nandakumarb7696 3 года назад
I really like it how you give the transcript as description. It saves a lot of time and helps in quick glance . I sincerely appreciate all the efforts and keep up the good job
@ronitsahu8500
@ronitsahu8500 5 месяцев назад
Waiting for part 3! Please upload if possible! Thanks for your contribution.
@user-dw9ol2qr7d
@user-dw9ol2qr7d 6 месяцев назад
@codedecode thank you so much ma'am for such great efforts and creating such useful videos and making learning java concepts easy. Could you please make next videos on multithreading? In many interviews I was asked about thread life cycle, thread pool, thread executor framework. Thank you in advance.
@secretsociety2510
@secretsociety2510 3 года назад
Please continue with part 3 as well. Your videos are really helpful in understanding these concepts. I've #subscribed the channel and eagerly waiting for upcoming part.☺️
@CodeDecode
@CodeDecode 3 года назад
sure amogh videos are lined up it will get uploaded in couple of weeks
@jaiganeshshan5182
@jaiganeshshan5182 2 года назад
@@CodeDecode Link for Part3 pls
@nikhilmhatre823
@nikhilmhatre823 Год назад
@@CodeDecode Where is 3rd part?
@tanugupta8703
@tanugupta8703 Год назад
@@CodeDecode where is the 3rd video
@avinashxvr52
@avinashxvr52 2 года назад
Great explanations most of the questions that you have covered are repeated in majority of the interviews. One question i came across. Find if a number is odd or even or prime using three threads ,and the result should maintain the natural order
@CodeDecode
@CodeDecode 2 года назад
Very nice question Avinash, we will cover it for sure 👍👍
@rushikeshgodase8498
@rushikeshgodase8498 6 месяцев назад
printing odd or even using two threads i know. But how can we print odd or even or prime using three threads??
@TheAnaveni
@TheAnaveni 2 года назад
I'm really impressed your explanation please make more videos to continue this multithreding concepts , I'm watching all the other videos as well because good explanation
@CodeDecode
@CodeDecode 2 года назад
Thanks Anil 🙂👍
@TheEntium
@TheEntium 3 года назад
Thanks for these kind of content.. they are really helpful.. i really appreciate your hardwork...
@CodeDecode
@CodeDecode 3 года назад
Thanks Entium 👍👍👍
@chilukabharath4809
@chilukabharath4809 3 года назад
Nice Videos till now watched all videos of Interview Questions playlist, please collect the more interview questions for java,spring and keep post regularly. we want more............ interview questions😋. subscribed waiting for the videos.
@CodeDecode
@CodeDecode 3 года назад
Sure Chiluka, will collect more and will upload soon 👍👍
@jayakrishnathammana
@jayakrishnathammana 3 года назад
Wonderful, very good explanation. Please try to group all of them by providing links to the previous videos. This will help users to connect previous sessions....
@CodeDecode
@CodeDecode 3 года назад
Thank you, We will create the separate playlist for that.....
@saumilwaghela4543
@saumilwaghela4543 3 года назад
Ma'am kindly continue the third part as well as add Exector, fork join as well
@CodeDecode
@CodeDecode 3 года назад
Sure Saumil, we will include join and Executor in next video. 👍👍
@vaibhavkalgude9316
@vaibhavkalgude9316 3 года назад
Also please add the concept of synchronization, concurrency
@gauravjaiswal7923
@gauravjaiswal7923 2 года назад
@@CodeDecode Thanks a lot for the video, Please make video on executor.
@pankajsharma31
@pankajsharma31 2 года назад
Waiting for more video on threading including Project level usage
@madhanmmm6383
@madhanmmm6383 2 года назад
Please continue with the 3rd part
@techiebrat9498
@techiebrat9498 3 года назад
This channel deserve more subscribers . Great content and explanation Thank you ma'am
@CodeDecode
@CodeDecode 3 года назад
This means a lot 🙂🙂👍👍. Thanks Santhosh
@sandeshg6267
@sandeshg6267 3 года назад
Really appreciate ur work 👍👍👍..this could be the best explanation on multithreaded concept in a simple yet crispy way..pls cover all the multithreaded concepts like..deadlock nd concurrency etc..
@CodeDecode
@CodeDecode 3 года назад
Sure Sandesh. We will cover them soon 👍👍
@iask9999
@iask9999 3 года назад
Thanks madam.. I understood about threads now.. please continue it
@CodeDecode
@CodeDecode 3 года назад
sure we will continue on this ....
@madhanmmm6383
@madhanmmm6383 2 года назад
Please continue with the video of remaining topics. Content is very help full.
@CodeDecode
@CodeDecode 2 года назад
Thanks Madhan 🙂👍
@venkatasaikrishnak6984
@venkatasaikrishnak6984 3 года назад
Please continue with next part and explain all main changes introduced in Java8 also. Please include Executors framework as well.
@CodeDecode
@CodeDecode 3 года назад
Sure Venkata 👍👍
@rishikachowdarypotturu3488
@rishikachowdarypotturu3488 3 года назад
This couldn't be any better..Great
@CodeDecode
@CodeDecode 3 года назад
Thanks Rishika...
@steffianusha9444
@steffianusha9444 4 месяца назад
Great Video! Part 3 is there?
@sureshgarine
@sureshgarine 2 года назад
Madam kindly continue third part as well, this is very knowledgeable. thank you
@CodeDecode
@CodeDecode 2 года назад
Sure Suresh 👍👍
@vishalsepaia3448
@vishalsepaia3448 3 года назад
Hi, Appreciate your content, its very helpful. Please also cover some more advance concepts like concurrency, Parallelism, Read / Write Locks, Deadlock Prevention etc.
@CodeDecode
@CodeDecode 3 года назад
Sure Vishal. We were just trying to clear basic concepts with these videos. From next video onwards, we will pick higher level questions
@ishantsharmaa
@ishantsharmaa 3 года назад
Hi You have explained it very well and its really helpful.
@CodeDecode
@CodeDecode 3 года назад
Thanks karthik 👍👍
@AyushRastogi501
@AyushRastogi501 2 года назад
great video .. we definitely need 3rd part .
@CodeDecode
@CodeDecode 2 года назад
Sure Ayush 👍👍
@sharmarahul17
@sharmarahul17 Год назад
Really appreciates ur work 👍. Thanks
@CodeDecode
@CodeDecode Год назад
Thanks Rahul 😁
@crazeeealgorithms3236
@crazeeealgorithms3236 2 года назад
Thank You for awesome explanation....Please upload next video....
@CodeDecode
@CodeDecode 2 года назад
Sure 👍👍
@athithirajesh4u
@athithirajesh4u 3 года назад
Next video please for multithreading. It's very good set of questions. Please include interview questions for executor framework as well.
@CodeDecode
@CodeDecode 3 года назад
That we will cover in next part for sure Rajesh 👍👍
@syedr16
@syedr16 Год назад
Yes..even i wanted the video on executor service and other concepts like life cycle of a thread
@lodhaaashish
@lodhaaashish 2 года назад
Great content!! Please have more videos on threads, life cycle, join, thread executor, future, etc
@CodeDecode
@CodeDecode 2 года назад
Thanks Aashish. Sure we will put more such videos 🙂🙂
@yashaggarwal7805
@yashaggarwal7805 2 года назад
Thank you so much ....your efforts are much appreciated!!!! Could you please create some other videos covering advanced concepts on this like inter thread communication, Executor framework please.
@CodeDecode
@CodeDecode 2 года назад
Thanks. Sure Yash! We will do that soon 👍🙂
@drashtinaik5751
@drashtinaik5751 3 года назад
Have you created next part of multithreading video.? like part 3? for life cycle ,sleep and notify and other things..? Please create it . Please create video on deadlock condition and its solution.
@hyndavibhupathiraju9292
@hyndavibhupathiraju9292 2 года назад
Wonderful, Very good explanation..can you please continue with concepts of multithreading and make another video on it
@CodeDecode
@CodeDecode 2 года назад
Sure we will do that👍👍
@coolniki92
@coolniki92 3 года назад
need next part as well...pls do make video on other methods as well Madam... Thanks in advance
@CodeDecode
@CodeDecode 3 года назад
Sure Nikita👍👍
@lathasree1659
@lathasree1659 9 месяцев назад
hi Ur videos are excellent .we can crack most of the interviews be referring all Ur playlist . plz cover executers in multithreading also .
@CodeDecode
@CodeDecode 9 месяцев назад
Thanks a lot lathasree ❤️❤️😊
@Hassan-dj6pu
@Hassan-dj6pu Год назад
Please upload third part of multithreading explaining all the remaining topics!!!
@ishitakumari2524
@ishitakumari2524 6 дней назад
please cover the rest of the topics from multi-threading..
@manishkartik1275
@manishkartik1275 2 года назад
Please add 3rd Part of this video. Much needed
@CodeDecode
@CodeDecode 2 года назад
Sure Manish 🙂👍
@Ravikumar-gj6qw
@Ravikumar-gj6qw Год назад
Yes , we want code decode
@CodeDecode
@CodeDecode Год назад
😇
@desurajasekhar349
@desurajasekhar349 2 года назад
please create the next video. It was a simple and great explanation.
@CodeDecode
@CodeDecode 2 года назад
Sure Thanks 🙂👍
@supun_sandaruwan
@supun_sandaruwan Год назад
really helpful thank you very much
@CodeDecode
@CodeDecode Год назад
You're welcome
@OneEthio
@OneEthio 3 года назад
Thanks 🙏 it really helps, can you please post interview questions on spring framework
@CodeDecode
@CodeDecode 3 года назад
Sure 👍👍we will upload spring interview questions soon 👍👍
@rachitshukla9112
@rachitshukla9112 3 года назад
Plz create a video on executor services as well.. Your video is very helpfull..thank you
@CodeDecode
@CodeDecode 3 года назад
sure rachit we will plan and create it soon......
@rishiraj2548
@rishiraj2548 6 месяцев назад
great thanks!
@CodeDecode
@CodeDecode 6 месяцев назад
You're welcome!
@sankargavireddy341
@sankargavireddy341 2 года назад
Very nice . Can you make one video on asynchronous thread using spring @aysnc and also thread pool and Complable & feature objects
@CodeDecode
@CodeDecode 2 года назад
Sure Sankar 👍🙂
@nehalpatil7551
@nehalpatil7551 Год назад
Please create the third part. Thanks!
@gokulaher2476
@gokulaher2476 3 года назад
No issue with the pace its ok.. Any Github url? with source code...
@kazaasekhar
@kazaasekhar 2 года назад
very nice if possible cover remaining topics too in threads
@CodeDecode
@CodeDecode 2 года назад
Thanks Sekhar 👍🙂. Sure
@sreejak6776
@sreejak6776 3 года назад
Mam please make other part also by including the topics and practical implementation
@CodeDecode
@CodeDecode 3 года назад
Sure Sreeja, we will move this series ahead soon 👍👍
@sourabhkumarsingh9236
@sourabhkumarsingh9236 2 месяца назад
Please upload part 3 with executors service and forked join pool.
@harshitsachdeva4836
@harshitsachdeva4836 3 года назад
As already said we need microservices video series.
@CodeDecode
@CodeDecode 3 года назад
Please click on bell Icon, you will be notified once it's upload 🙂👍👍
@shreyakotak3754
@shreyakotak3754 2 года назад
Ma'am kindly continue this series
@CodeDecode
@CodeDecode 2 года назад
Sure Shreya 👍👍🙂🙂
@PraveenKumar-ge5zf
@PraveenKumar-ge5zf Год назад
Please create the next part covering all the remaining multi threading concepts.
@CodeDecode
@CodeDecode Год назад
Sure we will create it soon
@PraveenKumar-ge5zf
@PraveenKumar-ge5zf Год назад
@@CodeDecode thanks. Waiting for the same.
@krushnnabaviskar4131
@krushnnabaviskar4131 Месяц назад
Thanks
@CodeDecode
@CodeDecode Месяц назад
😊👍
@sreejak6776
@sreejak6776 2 года назад
Mam please make next parts of this series with more important questions
@CodeDecode
@CodeDecode 2 года назад
Sure Sreeja we will do that soon 👍🙂
@krishnanandgupta6789
@krishnanandgupta6789 Год назад
Hi ma'am I have been following your videos and are very helpful. Please can you tell when is the executor frameworks video is coming.
@CodeDecode
@CodeDecode Год назад
Hey Krishna we will create video on executor framework soon.
@venkatsai2541
@venkatsai2541 2 года назад
please continue next part also
@CodeDecode
@CodeDecode 2 года назад
Sure...
@riyapatil6075
@riyapatil6075 6 месяцев назад
Can you please cover ExecutorService, countdownlatch, cyclicbarrier concepts please
@priyankachougule4334
@priyankachougule4334 3 года назад
next part of multithreading, please
@CodeDecode
@CodeDecode 3 года назад
sure we will create one soon
@nupurpal6664
@nupurpal6664 3 года назад
Can you please do video on thread life cycle , it would be great help
@CodeDecode
@CodeDecode 3 года назад
Sure Nupur, we will cover that too 👍👍
@malaiarasi4400
@malaiarasi4400 2 года назад
Mam please next continuation of this video
@CodeDecode
@CodeDecode 2 года назад
Sure we wil continue this series soon 👍🙂
@sunanthasundaram1284
@sunanthasundaram1284 2 года назад
Thanks for the concepts! When will the multi threading part 3 be released?
@CodeDecode
@CodeDecode 2 года назад
we will make it soon sunantha
@Akashsingh-kw2qo
@Akashsingh-kw2qo 2 года назад
Hi ma'am, Waiting for Multithreading related to life cycle, notify, notify all, sleep, wait etc? please upload.
@CodeDecode
@CodeDecode 2 года назад
Sure Akash we will upload soon 👍🙂
@Th0RisLive
@Th0RisLive 2 года назад
If possible can you please cover the locking mechanism in next part.
@CodeDecode
@CodeDecode 2 года назад
Sure Shubham 👍👍
@jayantkumar402
@jayantkumar402 3 года назад
Can you do a third video of Multithreading related to life cycle, notify, notify all, sleep,wait etc?
@CodeDecode
@CodeDecode 3 года назад
Sure Jayant we will surely create that video
@start1learn-n171
@start1learn-n171 2 года назад
Tq
@CodeDecode
@CodeDecode 2 года назад
🙂🙂
@neeleshmohanty7380
@neeleshmohanty7380 Год назад
we need more videoes regarding mutithreading
@CodeDecode
@CodeDecode Год назад
sure we will create it soon
@musicalstringsentertainmen4340
@musicalstringsentertainmen4340 2 года назад
please bring part 3 for multi threading
@CodeDecode
@CodeDecode 2 года назад
sure we will create it soon...
@vaibhavchoudhary3826
@vaibhavchoudhary3826 3 года назад
please create part 3 of multithreading and contain all the rest things
@CodeDecode
@CodeDecode 3 года назад
Sure Vaibhav, we will do that 👍👍
@prudhvinadh5786
@prudhvinadh5786 Год назад
Hi code decode, I have gone through the multithreading videos 1 and 2. and In interview I have explained thread and how to create etc. Interviewer asked me what is deadlock in threads. and concurrency in threads. and he said if I have multiple threads t1, t2, t3 is there, Is there a way I can call t2 thread first next t3 and t1 to execute. I said Namasthe, I will learn and comeback. Could you please cover those or else If you had already made a video on this could you give me link to it.
@nancyagarwal8570
@nancyagarwal8570 3 года назад
Hi Mam, can you plz make video on executorService, callable, Future and completablefuture.
@CodeDecode
@CodeDecode 3 года назад
Sure. That mostly asked questions I'm interviews. We will surely create them 👍👍
@jayakrishnathammana
@jayakrishnathammana 3 года назад
If you have part -1 for Java multithreading , can you include in description???
@CodeDecode
@CodeDecode 3 года назад
Updated in the description please check....
@aditisingh6330
@aditisingh6330 16 дней назад
Please upload the part 3 also
@CodeDecode
@CodeDecode 15 дней назад
Sure we will upload it soon
@satyanarayanareddyb3052
@satyanarayanareddyb3052 Год назад
please give the continuation video of this Part3
@CodeDecode
@CodeDecode Год назад
Sure 👍
@nehajoshi5238
@nehajoshi5238 3 года назад
Please create another video on executor framework
@CodeDecode
@CodeDecode 3 года назад
Sure Neha 👍👍
@AllinOne-et2on
@AllinOne-et2on 2 года назад
Please try to do it 3rd on multithreading
@CodeDecode
@CodeDecode 2 года назад
Sure we will upload it soon.....
@rajavardhanmothkuri2334
@rajavardhanmothkuri2334 3 года назад
What if I create a user thread and extend thread class and don’t override run method will user thread be created?
@CodeDecode
@CodeDecode 3 года назад
If we don't override Thread class run() method in our defined thread then Thread class run() method will be executed and we will not get any output because Thread class run() is with an empty implementation.
@jithinbp7168
@jithinbp7168 Год назад
is there part 3 ?
@jitendratrivedia6310
@jitendratrivedia6310 3 года назад
Keep it up ladki. :)
@CodeDecode
@CodeDecode 3 года назад
Thanks 😁
@gaurideshpande1323
@gaurideshpande1323 2 года назад
Please make another video which will cover rest of the questions. Also please include inter thread communication questions. 🙏
@CodeDecode
@CodeDecode 2 года назад
Sure Gauri we will do that 👍🙂
@pareshpatil8679
@pareshpatil8679 11 месяцев назад
next part please
@CodeDecode
@CodeDecode 11 месяцев назад
Sure we will upload it soon
@srisurekhacherukuri7148
@srisurekhacherukuri7148 2 года назад
can you please upload the remaining concepts for multi threading
@CodeDecode
@CodeDecode 2 года назад
Sure sri 👍
@varunb2453
@varunb2453 2 года назад
When we can expect part 3 of multithreading?? please
@CodeDecode
@CodeDecode 2 года назад
Soon Varun 👍🙂
@sukanyas7948
@sukanyas7948 Год назад
Is there a third video on this topic?
@abhishekpatil4232
@abhishekpatil4232 2 года назад
Please create next video
@CodeDecode
@CodeDecode 2 года назад
Sure Abhishek 🙂👍
@mayurishinde4968
@mayurishinde4968 Год назад
What is the use of daemon thread ?
@satyam3608
@satyam3608 2 года назад
When we can expect part 3 of multithreading??
@CodeDecode
@CodeDecode 2 года назад
We will upload it soon Satyam 👍🙂
@maulshreesaxena5833
@maulshreesaxena5833 5 дней назад
Where is the next video?
@shalupriya8805
@shalupriya8805 3 месяца назад
Where is the third part @Code Decode
@himanshugupta7477
@himanshugupta7477 2 года назад
How to access these docs?
@nightraider877
@nightraider877 2 года назад
where is part 3
Далее
КАКОЙ У ТЕБЯ ЛЮБИМЫЙ МАРМЕЛАД?
00:40
▼ЧЁРНАЯ МАГИЯ 🔮
31:15
Просмотров 513 тыс.
Multithreading in Java Explained in 10 Minutes
10:01
Просмотров 886 тыс.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Coding Was Hard Until I Learned THESE 5 Things!
7:40
КАКОЙ У ТЕБЯ ЛЮБИМЫЙ МАРМЕЛАД?
00:40