Most Asked Multithreading Interview Questions and Answers in Java | Code Decode
In this video of code decode, you will learn Multithreading Interview Questions and Answers in Java for experienced and freshers 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
---------------------------------------------------------------------------------------------------------------------------------------
Q) What is MultiTasking And Its types. In java interview question and Answers
Performing multiple tasks at one time . There are 2 types of multitasking :
Process based multitasking
Thread based multitasking
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
Q) Which is better process based multitasking or thread based multitasking and why is one of the most asked java interview question and Answers?
Thread based multitasking is better.
Multitasking threads require less overhead than multitasking processes.
Processes are heavyweight tasks that require their own separate address spaces.
Threads, on the other hand, are lighter weight. They share the same address space and cooperatively share the same heavyweight process.
Interprocess communication is expensive and limited. Context switching from one process to another is also costly. In java interview
Q) Which is better process based multitasking or thread based multitasking and why?
Inter Thread communication is inexpensive, and context switching from one thread to the next is lower in cost.
While Java programs make use of process-based multitasking environments, process-based multitasking is not under Java’s direct control. However, multithreaded multitasking is.
Q) What is a Thread
Threads are light-weight processes within a process.
Java creates threads by using a "Thread Class".
All Java programs have at least one thread, known as the main thread, which is created by the Java Virtual Machine (JVM) at the program’s start, when the main() method is invoked with the main thread.
Q) Types of Thread in java
There are two types of thread - user thread and daemon thread.
Q) How to create a user thread in Java
Thread implementation in java can be achieved in two ways:
Extending the java.lang.Thread class
Implementing the java.lang.Runnable Interface
When the JVM starts, it creates a thread called “Main”. Your program will run on this thread, unless you create additional threads yourself. The first thing the “Main” thread does is to look for your static void main (String args[]) method and invoke it. That is the entry-point to your program. If you create additional threads in the main method those threads would be the child threads of main thread.
----------------------------------------------------------------------------------------------------------------------------------------
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 : kzread.info?...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
#javainterviewquestions #multithreadinginterviewquestions #codedecode
Пікірлер: 222
Hi Madam, Ur videos are very clearn and gr8. Gr8 job yr doing. keep doing madam ji. I would like to see more videos.. 1. Muti Threading -- more detailed one. 2. MicroSevices 3. Spring Data JPA & Spring Data Rest 4. Deep Cloning & Shallow Cloning.
@CodeDecode
3 жыл бұрын
Sure SreeRaam. These are really nice topics. We will create videos on them too 👍👍
Yes go for more thread topics, wait notify executor api , future, CF etc
@CodeDecode
3 жыл бұрын
Sure Sahil.
@callmeghostgamer
2 жыл бұрын
Is there any video on executor and future?
Watched several videos and it was great learning. The way you explain difficult topics in a simple way is commendable. You are amazing and really talented mentor. Keep up the good work and I am sure within no time your channel will grow so fast 😊😊
@CodeDecode
3 жыл бұрын
Thank u so much Karishma. This means a lot 🙏👍.
Hi code decode, today I passed 2nd round interview. Thank you. I hope you make tech video until I retire. And I am a recent graduate with 1 year of experience.
@CodeDecode
Жыл бұрын
Many congratulations 🎉🎉🎉👏👏👏👏👏. Well deserved man 👍👍👍👍
One of the best tutor on youtube , explain topics with real life problems . Big Fan 😁😁😁😁
@CodeDecode
2 жыл бұрын
Thanks Sahil 🙂🙂👏👏
Thank you so much for being the part of our professional journey. Your videos are helping so much for clearing interviews. Please do more videos on core java. This channel is going to become reference for java interviews(Please make note of it).
@CodeDecode
3 жыл бұрын
Thanks for being a part of team code decode Mallikarjuna . sure we will upload more videos on core Java
Your explanations are simple , crisp and easy to understand the core concepts. Thank you so much for the good work.
@CodeDecode
2 жыл бұрын
Thanks Nibedita 🙂👍
Very accurate elaborate explanation.. helps to clear basics again when we tend to forget day to day work. Thanks for taking this effort and making the video
@CodeDecode
Жыл бұрын
Thanks Adrija 👍👍🙂🙂
The time you explained a thread with example... I couldn't resist myself to write a comment..... Thanks for sharing the knowledge.... 🥰please keep making videos like this
@CodeDecode
Жыл бұрын
Means a lot to us Pooja. These comments keeps us motivated to put more such videos 🙏🙂. Thanks ❤❤
fast of all, you have a nice voice and your explanation was awesome,thank you keep doing more like this.👍❤
@CodeDecode
Жыл бұрын
Thanks Rajashekar
Hello, your videos are very helpful because they are informative . Please make the second part as well so this topic will be covered fully. Thanks.
@CodeDecode
3 жыл бұрын
Sure Ahmet 👍. Thanks for helping us in deciding the priorities.
Love the way you explain so easily!! Thank you so much!
@CodeDecode
2 жыл бұрын
Thanks Shreya 🙂👍
Very good content. Please make a second part with Multithreading with the collection. Also, make videos on Data structure and algorithm interviews question. Also on spring boot annotations
@CodeDecode
3 жыл бұрын
Sure Nitigya, we will create a video covering this 👍👍
Great explaination, please make a part 2 which covers some advanced topics such as ExecutorService
@CodeDecode
3 жыл бұрын
Sure, we will cover that too soon 👍👍
really a big gift for beginners, tq maam
Thank you so much, your tutorials has helped me a lot and all of my concepts get cleared with which I was having difficulty :)
@CodeDecode
2 жыл бұрын
We are so glad to hear that Shanawaj 🙂🙂👍👍thanks a lot
Very much Useful Video...am waiting for this video.... thank you very much.... explanation is very much clear... thanks for sharing this...😊
@CodeDecode
3 жыл бұрын
Thanks Karthick 👍👍
please make video on join ,wait,sleep as well .there are so much scenarios based question are asked by interviewer. And also on Locking and Executor framework
Your doing a great job madam 🙏🙏🙏 your videos are really helping a lot to me..Thank you Madam
@CodeDecode
3 жыл бұрын
Thanks for writting back to us Basavaraj. M glad it helps 👍👍
This is so helpful. Thank you!
@CodeDecode
3 жыл бұрын
We are glad it is Sachintha. 👍👍😊😊
Your videos are useful for me....thanks a lot. expecting more videos
@CodeDecode
3 жыл бұрын
Sure. We will upload more videos 👍👍🙏🙏
Lucky to come across your channel during my interview preparation❤️❤️..
@CodeDecode
2 жыл бұрын
Thanks Kaushiki 🙂🙂👍👍
The content and way of explaining is really great !!
@CodeDecode
2 жыл бұрын
Thanks
Such an awesome explanation! Thank you
@CodeDecode
2 жыл бұрын
Thanks Savita 👍
Great video! One small thing is that you were mentioning as context switching. It’s not so, actually both main and thread runs in parallel. That’s both sysout getting printed in random order
@CodeDecode
11 ай бұрын
What if there is only 1 core ? Parallel processing is not possible then right?
Hi, your videos are good source of learning. Keep up good work. My request to you please make videos on Threading from concurrent package i.e. ExecutorService, ReentranctLock, Semaphore etc.
@CodeDecode
2 жыл бұрын
Sure Viki. We will do that soon 🙂👍. Nice topics
I agree with @Karishma Rawat. Please make a content on Context Switching. Thank you for the well detailed series of videos on java and rest of the technologies. 🙏
@CodeDecode
2 жыл бұрын
Sure Madhan. We will put video on that soon 🙂🙂👍👍
@phanikiranbodavula5523
2 жыл бұрын
yes @Karishma , Can you please do it
Perfect!! Keep the good work💯💯
@CodeDecode
2 жыл бұрын
Thanks 🙂👍
Thanks a lot, it was so easy but it took me so much time to understand, thanks a lot again
@CodeDecode
Жыл бұрын
🙂🙂👍👍 glad it helps
Thank you so much for the video . Can you please explain Executer framework and why and when it should be used ?
Very well explained. Please do make second part of multithreading
@CodeDecode
3 жыл бұрын
Thanks . Sure we will make it soon....
Going Good, keep uploading such interview questions
@CodeDecode
2 жыл бұрын
Sure we will upload more
Please add more videos for multithreading .Can you cover all the topics in multithreading
Hi code decode do more videos on multithreading keep it up
@CodeDecode
Жыл бұрын
Sure thanks 🙂
Great explanation, Thank you :)
@CodeDecode
Жыл бұрын
🙂🙂👍👍
Thank you very much di❤🚩.
tq madam...keep going...its very helpful
@CodeDecode
2 жыл бұрын
You are welcome Naresh .....
Great content and very helpful. Could you please provide a session on Executor Pattern? That would really help 🙏🙏
@CodeDecode
Жыл бұрын
Sure nisith we would make it soon
Please upload the next video of multithreading. I need it. Appreciate your hard work.
@CodeDecode
3 жыл бұрын
It is live now please check kzread.info/dash/bejne/poB6k9mSitaacs4.html
Hi Mam, First of all thank you for this crystal clear explanation. Could you please make videos on sorting like (Merge, Heap, Quick, Bubble), I mean how exactly these sorting algorithm internally works, what are their complexities & performance & in which scenario we should use which one? As this is the most asked interview questions. Also in Collections.sort & Arrays.sort which sorting algorithm uses & why?
@CodeDecode
3 жыл бұрын
Sure Rajat. We will do that sure 👍👍
@rajatmahajan5112
3 жыл бұрын
@@CodeDecode Thanks for the response mam. Could you please make video on SOLID Principles & where & how can we use this principles in our project. As it is also asked many times in interview?
@CodeDecode
3 жыл бұрын
Sure Rajat. We will create a video on solid principles too 👍. It's a nice topic 👍👍
complex things you are making easy
@CodeDecode
7 ай бұрын
Thanks
so nice of you for helping.
@CodeDecode
3 жыл бұрын
M glad it helps Gyanaranjan 👍👍
love love love !!! thankyou !!!
@CodeDecode
10 ай бұрын
❤️❤️
Thank you for the great content... Can we create a thread by using callable Interface ...?
@CodeDecode
3 жыл бұрын
no it cannot be done. only runnable interface can create thread
Mam please make video on comparable future and other advance topics🙏🏻 you are amazing. Thank you so much❤️
@CodeDecode
2 жыл бұрын
sure we will create video on it
Mam after watching you video my all concept all clear 😊😊
@CodeDecode
8 ай бұрын
All the best pratik
your work is amazing. could u please make some more videos on multithreading?
@CodeDecode
Жыл бұрын
Thanks Tej . Sure 👍👍
Please continue with second video. Nice explanation
@CodeDecode
3 жыл бұрын
Sure. Thanks Pinky for helping us in deciding the priority
Hey please create a 2nd part of this video with the details on thread scheduling and other concept like joining 2 threads etc etc. This really helps in quickly brushing up the concepts.
@CodeDecode
3 жыл бұрын
Sure Souvik, we will upload next part very soon 👍👍
Please make full video multithreading and cover all methods of Thread class.
@CodeDecode
2 жыл бұрын
Sure Nilesh 🙂👍
Excellent Explanation. Appreciate your efforts. Are you working with some organisation?
@CodeDecode
2 жыл бұрын
Thanks Vaibhav, yes we all are working IT professionals.
really good one like it
@CodeDecode
2 жыл бұрын
Thanks shekhar....
Great explaination, Could you please do one video of HashSet in Java and internal DS implement HashSet in Java
@CodeDecode
3 жыл бұрын
Sure, in next video, we will cover that👍👍
thank you, madam, nice explanation 😊😊😊
@CodeDecode
3 жыл бұрын
You're welcome suresh.....
Excellent explanation
@CodeDecode
2 жыл бұрын
Thanks Vaishnavi
Hey Code Decode Team, Appreciate your efforts!! Please make a list of all the annotations used in spring framework from spring core to all other useful modules and make a video on it with example. Interviewers asks most of the annotations in interview so it will help to many people to go through all annotations at one place... Thanks for sharing knowledge...
@CodeDecode
3 жыл бұрын
Sure. we will make that video too
Well explained!
@CodeDecode
3 жыл бұрын
Thanks....
Girl you rock thanks !
@CodeDecode
Жыл бұрын
Thanks 🙂🙂👍👍❤
Thank u very much for the video madam..your videos really helping me to attend the interviews..could u plz make a video on springboot annotations and also on exception handling only 1 video is there..plz make a another video on expection handling.
@CodeDecode
3 жыл бұрын
Sure Basavaraj 👍👍we will upload them soon 👍👍👍
@basavarajnv1017
3 жыл бұрын
@@CodeDecode Thank you 😊
@CodeDecode
3 жыл бұрын
👍👍all the best for your interviews 🙂🙂
Thanks for ur efforts on this ..can you please make vide on memory management
@CodeDecode
2 жыл бұрын
Sure Naveen we will create it soon
Excellent content!
@CodeDecode
11 ай бұрын
Thanks
Hi Madam Please create a second video which is include all remainng parts of thread .your videos are very helpful Thank you
@CodeDecode
3 жыл бұрын
Sure Shweta, we will do that very soon 👍
great video
@CodeDecode
2 ай бұрын
Thanks Aman 👍
Thanks for the info
@CodeDecode
3 жыл бұрын
You're welcome....
Please make a video about Thread Scheduler !!!
@CodeDecode
11 ай бұрын
Thanks Jitesh 🙂🙂
Please continue with second video also thanks for the great content 😃
@CodeDecode
3 жыл бұрын
Thanks Madhuri. It will help us in understanding what next video should be on
@lakshaygupta6180
3 жыл бұрын
Waiting for the 2nd Video
@CodeDecode
3 жыл бұрын
It's almost ready. We will upload soon 👍👍
@madhu56236
3 жыл бұрын
@@CodeDecode Thank you
@athithirajesh4u
3 жыл бұрын
Waiting for multithreading part 2
Video is super useful.Please dont move ur curson.
@CodeDecode
3 жыл бұрын
Thanks Simran. 😊👍. We are really sorry that this disturbs you but we needed to keep us concentrated on the slides as it's very difficult to shoot 30 mins long video talking alone without getting distracted 😅😅😁😁. We will try to reduce it. Thanks for the suggestion 👍👍
nice explanation
@CodeDecode
2 жыл бұрын
Thanks sachin
nice, please do detailed videos on multi threading with examples mam
@CodeDecode
2 жыл бұрын
Sure we will upload them soon 👍🙂
Yes threading is much important.
@CodeDecode
2 жыл бұрын
🙂👍
Your explanation is awesome.. it's really refreshment course with solid details... Appreciate it
@CodeDecode
2 жыл бұрын
Thanks for the nice words
amazing mam Keep it upp
@CodeDecode
3 жыл бұрын
Thanks 🙏
Continue make videos on this session plz
@CodeDecode
Жыл бұрын
sure
we can call the run method on class which is implemented by runnable right
@CodeDecode
2 ай бұрын
Yep
Good content
@CodeDecode
3 жыл бұрын
Thanks Piyush 👍👍
u r telling excellent content . but my small suggest is u r telling too fast keep some slow.
@CodeDecode
9 ай бұрын
Very true. Sure in upcoming videos we will take things slow
yes please make a continuation video
@CodeDecode
3 жыл бұрын
Sure 👍👍
Please make video on unit testing..
@CodeDecode
2 жыл бұрын
Yes it's in pipeline for us Kumar 🙂👍
Can you write program to design a game like soccer .. which was asked in interviews using threads
Great content, clear explanations. Are you a Gujarati? :)
@CodeDecode
3 жыл бұрын
Thanks Jai🙃. Yes I am 🙂🙂.But I am an Indian too 😝
@jaikishanpatel7597
3 жыл бұрын
@@CodeDecode Right, I should've asked if you are an Indian with Gujarati as your mother tongue. 🙂👍
@CodeDecode
3 жыл бұрын
@@jaikishanpatel7597 😝😝😂😂
Please make os vedio for us..🖥️💛
@CodeDecode
2 жыл бұрын
👍👍
Time to add completable future in the list?.🤔
Please make videos for Amazon Coding question in java
@CodeDecode
3 жыл бұрын
Sure 👍👍
Ma'am, microservices interview questions please....
@CodeDecode
3 жыл бұрын
Yes we are planning and we will create the videos soon...
Can u make vedios on Maven install , maven update related features of maven project
@CodeDecode
3 жыл бұрын
Yes we are planning on that .... we will make it soon.....
please post a new video with the more details like thread scheduler and deamon threads
@CodeDecode
2 жыл бұрын
Sure 👍👍🙂🙂
Please do the video on completablefuture
@CodeDecode
3 жыл бұрын
Nice topic 👍 will do that for sure 👍👍
@thinklog3888
3 жыл бұрын
@@CodeDecode Thanks and in the last of the tut please just describe solid principles of java .I mean just for 2-3 mntes if possible..👍
Finally👍
@CodeDecode
3 жыл бұрын
You commented so many times that we had to 😅😅. Just kidding. Thanks for the nice suggestion, we enjoyed creating it.
@reactjsdeveloper8758
3 жыл бұрын
@@CodeDecode 😆 now we will wait for the inner class topic
@CodeDecode
3 жыл бұрын
Sure 😅
Could you help me with the transient and volatile
Hi Mam..Can I post some testing tough questions will you answer in your next video?
@CodeDecode
3 жыл бұрын
Sure Raj. You can. We will answer them in upcoming videos
@RajKumar-ij5rr
3 жыл бұрын
@@CodeDecode What are the few interesting defects/bug you have found and got compliment from your manager? What are the challenges that we might face while performing Parallel,Cross browser testing? Find some general issues/challenges when you move software from UAT environment to Production? Once you make a video on these questions I will post remaining questions...
Can you explain the internal working of hashmaps
@CodeDecode
3 жыл бұрын
Sure 👍👍
Can you just explain what happens to a service when multiple say 1000 requests are sent at the same time. how multithreading can be related here ?
Can you do a video for changing the default server from tomcat to any other server in springboot application.
@CodeDecode
Жыл бұрын
We already have it
@satyanarayanareddyb3052
Жыл бұрын
@@CodeDecode Can you please link that video here?
@CodeDecode
Жыл бұрын
kzread.info/dash/bejne/Y6qbk7OgZsbbl8Y.html
@CodeDecode
Жыл бұрын
Mostly some where here; kzread.info/head/PLyHJZXNdCXsdXxY8wupiLenux2Yafn1lN
@satyanarayanareddyb3052
Жыл бұрын
@@CodeDecode Thank you so much
need more info ThreadScheduler please
@CodeDecode
Жыл бұрын
Sure 👍👍
Wat is ur linkedin profile mam ?
At time line 7:55 Q which is better (multi tasking) proceess base or thread base? Every running program is process And one process have multiplex threads to make the process run In short thread is a light weight process right? I mean a single thread is a lightweight process And a bunch of such thread running together makes a complete process
@CodeDecode
3 жыл бұрын
Multi threading is better. You can't keep on creating multiple processes for small tasks.
@gokulaher2476
3 жыл бұрын
@@CodeDecode Requesting you to pl. Create top 5 or 10 interview FAQs For executor framework and concurrency collection api.
Hi, I found there is a typo in the project name. Decode spelling is a mistake. It should be CodeDecodeThreadDemo instead of CodeDecoedThreadDemo. I know there is not an issue from a code point of view but it is impacting clean code architecture.
Can we extend run and implement runnable simultaneously, so we can use all methods
@CodeDecode
3 жыл бұрын
Extend run? You mean thread class??
@adityaprakash2781
3 жыл бұрын
@@CodeDecode yes like can we extend thread and implemet runnable simultaneously for a new clasa
@CodeDecode
3 жыл бұрын
Thread class already internally implements runnable. Why do you need to do it explicitly
@adityaprakash2781
3 жыл бұрын
@@CodeDecode no just was eager
@adityaprakash2781
3 жыл бұрын
Thanks for the reply tough
where is the second part of the video?