Loading...

Java Multithreading Interview Questions

Java Multithreading Interview Questions
Java Multithreading Interview Questions and Answers  ► SUBSCRIBE --> https://www.youtube.com/user/rithustutorials?sub_confirmation=1 ► DOWNLOAD Presentation and Notes  --> https://courses.in28minutes.com/p/in28minutes-course-guide ► SPECIAL OFFER Java Interview Guide : 200+ Interview Questions and Answers --> https://www.udemy.com/java-interview-questions-and-answers/?couponCode=YOUTUBE-2019

--------------------------------------------------
MOST WATCHED TUTORIALS
--------------------------------------------------
► How to become an expert on Spring Boot, REST and Microservices? --> https://www.youtube.com/watch?v=jf6doctfxWQ
► WATCH 30+ Videos on SPRING BOOT --> https://www.youtube.com/playlist?list=PLBBog2r6uMCRcybG1UBB6yAqFZbwjAKHi
► CHECK OUT Our Most Watched Videos  --> https://www.youtube.com/playlist?list=PLBBog2r6uMCQhZaQ9vUT5zJWXzz-f49k1
► All Spring Boot Articles - http://www.springboottutorial.com/spring-boot-projects-with-code-examples

#HIBERNATE #JAVAINTERVIEW #INTERVIEW #SPRING #SPRINGBOOT #PROGRAMMING

----------------------------------------------
RECOMMENDED COURSES
----------------------------------------------
► Spring Framework Interview Guide - 200+ Questions & Answers --> https://www.udemy.com/spring-interview-questions-and-answers/?couponCode=YOUTUBE-2019
► Java Interview Guide : 200+ Interview Questions and Answers --> https://www.udemy.com/java-interview-questions-and-answers/?couponCode=YOUTUBE-2019

~~~~~~~~~~~~~~~~~~
Questions
~~~~~~~~~~~~~~~~~
185 . What is the need for threads in Java?
186 . How do you create a thread?
187 . How do you create a thread by extending thread class?
188 . How do you create a thread by implementing runnable interface?
189 . How do you run a thread in Java?
190 . What are the different states of a thread?
191 . What is priority of a thread? How do you change the priority of a thread?
192 . What is executorservice?
193 . Can you give an example for executorservice?
194 . Explain different ways of creating executor services .
195 . How do you check whether an executionservice task executed successfully?
196 . What is callable? How do you execute a callable from executionservice?
197 . What is synchronization of threads?
198 . Can you give an example of a synchronized block?
199 . Can a static method be synchronized?
200 . What is the use of join method in threads?
201 . Describe a few other important methods in threads?
202 . What is a deadlock?
203 . What are the important methods in Java for inter-thread communication?
204 . What is the use of wait method?
205 . What is the use of notify method?
206 . What is the use of notifyall method?
207 . Can you write a synchronized program with wait and notify methods?

--------------------------------------------------------------------------------------------
BEST SELLING COURSES - 30 DAY MONEY BACK GUARANTEE
--------------------------------------------------------------------------------------------
► Python For Beginners - Java to Python in 100 Steps --> https://www.udemy.com/learn-python-programming-for-java-programmers?couponCode=YOUTUBE-2019
► Master Microservices with Spring Boot and Spring Cloud --> https://www.udemy.com/microservices-with-spring-boot-and-spring-cloud/?couponCode=YOUTUBE-2019
► Spring Master Class - Beginner to Expert --> https://www.udemy.com/spring-tutorial-for-beginners/?couponCode=YOUTUBE-2019
► Your First Steps from Programmer to Software Architect --> https://www.udemy.com/software-architect-course-first-steps/?couponCode=YOUTUBE-2019
► Master Hibernate and JPA with Spring Boot in 100 Steps --> https://www.udemy.com/hibernate-jpa-tutorial-for-beginners-in-100-steps/?couponCode=YOUTUBE-2019
► Spring Framework Interview Guide - 200+ Questions & Answers --> https://www.udemy.com/spring-interview-questions-and-answers/?couponCode=YOUTUBE-2019
► Master Java Web Services and REST API with Spring Boot --> https://www.udemy.com/spring-web-services-tutorial/?couponCode=YOUTUBE-2019
► Learn Spring Boot in 100 Steps - Beginner to Expert --> https://www.udemy.com/spring-boot-tutorial-for-beginners/?couponCode=YOUTUBE-2019
► Java Interview Guide : 200+ Interview Questions and Answers --> https://www.udemy.com/java-interview-questions-and-answers/?couponCode=YOUTUBE-2019

---------------------------------------------------
Follow us on Social Media
---------------------------------------------------

► TWITTER --> https://twitter.com/in28minutes
► FACEBOOK --> https://www.facebook.com/in28Minutes
► INSTAGRAM --> https://www.instagram.com/in28minutes/
► LINKEDIN --> https://in.linkedin.com/in/rangakaranam

RRelated Posts

Java ExecutorService - Part 1 - Introduction

Learn how to parallelize your tasks and operations easily in Java without cooking up your own Threads. Part 1: Introduction - https://www.youtube.com/watch?v=6Oo-9Can3H8 Part 2: Type of Pools -

Java Interview Q&A on Multi-Threading

For any java/devops/developer/lead position related interview assistance/guidance/help, you can reach out me @ sivajavatechie5@gmail.com In this session, I explained most frequently asked Java

CComments

  • Soumya Babu
    source code of the eg?
  • phoenix
    Well done.
  • prasad rayudu
    Really Helpful video Sir,Thank You :)
  • Anirban Roy
    Excellent video
  • Vikrant Dheer
    Where we can find your multithreading & generics exercises code ?
  • Vivek Ingle
    How Below 4 method will work parallel in thread can U please explain

    ThreadExamples Example = new ThreadExamples();
    example.download&StoreBatting();
    example.download&StoreBolling();
    example.download&StoreFielding();
    example.MergingAllAPplication();


    Below way are correct or need to be create different classes for each downloaded method

    package threadDemo;

    public class ThreadExamples extends Thread{


    public void run(){
    System.out.println("hello");
    downloadAndStoreBatting();
    downloadAndStoreBolling();
    downloadAndStoreFielding();

    }

    public void downloadAndStoreBatting(){
    System.out.println("show downloadAndStoreBatting");
    }
    public void downloadAndStoreBolling(){
    System.out.println("show downloadAndStoreBolling");
    }
    public void downloadAndStoreFielding(){
    System.out.println("show downloadAndStoreFielding");
    }
    public void MergingAllAPplication(){
    System.out.println("show MergingAllAPplication");
    }


    public static void main(String[] args) {
    ThreadExamples Example = new ThreadExamples();
    Example.start();
    }

    }
  • phaze
    When will you Indians finally learn to pronounce the english language so people can watch these videos without getting cancer?
  • Alok Yadav
    Tysm
  • Neeraj Arora
    The last example the wait and notify are called by locking on different object.. not a good practice as you may miss a signal !!

    Also in the last example you could have simply used join. Not an amazing example to show wait and notify ...
  • Pankaj Dubey
    The thread stack also contains all local variables for each method being executed (all methods on the call stack). A thread can only access it's own thread stack. Local variables created by a thread are invisible to all other threads than the thread who created it. Even if two threads are executing the exact same code, the two threads will still create the local variables of that code in each their own thread stack. Thus, each thread has its own version of each local variable.

    All local variables of primitive types (boolean, byte, short, char, int, long,float, double) are fully stored on the thread stack and are thus not visible to other threads. One thread may pass a copy of a pritimive variable to another thread, but it cannot share the primitive local variable itself.
  • Pankaj Dubey
    how two thread can override the method argument value,every thread have own stack and method argument and local variable is maintained in the stack, can you please provide example and demonstrate, two thread can overide the local variable and share in between
  • Devendra Vishwakarma
    From where can I get the full document which you are going through in the video?
  • pulpo pulpo
    Where can we donwload a complete pdf or ppt file with all the explanations of each question?
  • Umesh Naik
    One big question why wait and notify methods in object class not in thread class?
  • Ravi Goli
    good job man. nice brief summarisation and good articulation than lot of other multithreading videos, which are either too verbose, or too slow, or too digressing with not-that-straight examples, or not articulated well enough. Thanks a lot!! for the free service.
  • Nirmal Mohanty
    After starting the thread I was checking the state using "test.getState()" & the result is RUNNABLE. So I think thread never have a state called RUNNING
  • Praveen Kumar
    Can u provide this PDF link ?
  • Moksud Ahmed
    Why the Thread that will provide us the bowling statistics is called "battingThread2" ? Shouldn't we call it "bowlingThread"?
  • dhruba rivu
    Very well explained in detail. Where can I get the source code?