Java Threads Interview Questions And Answers
Java Threads Interview Questions and Answers will teach you now that Threads are very important to the Java world and to many other languages. Java is capable of running more than one thread at a time, which is very useful, but can cause confusion if misused. As a specific example of the utility of threads, suppose you are designing an interface that accepts keyboard and mouse input from the user. Learn Java Threads to get Job preparation for a Java Threads programmer with this Java Threads guide
1 ► What is threaded programming and when is it used?
2 ► Why are wait(), notify() and notifyall() methods defined in the Object class?
3 ► Why are there separate wait and sleep methods?
4 ► What is the difference between Thread and Runnable types?
5 ► How does the run() method in Runnable work?
6 ► A Thread is runnable, how does that work?
7 ► Why not override Thread to make a Runnable?
8 ► What is the difference between a threads start() and run() methods?
9 ► Can I implement my own start() method?
10 ► Do I need to use synchronized on setValue(int)?
11 ► How do I create a Runnable with inheritance?
12 ► What are three ways in which a thread can enter the waiting state?OrWhat are different ways in which a thread can enter the waiting state?
13 ► What is the difference between yielding and sleeping?
14 ► How to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state?OrExtending Thread class or implementing Runnable Interface. Which is better?
15 ► What is mutual exclusion? How can you take care of mutual exclusion using Java threads?
16 ► What is the difference between preemptive scheduling and time slicing?
17 ► What invokes a threads run() method?
18 ► What is the purpose of the wait(), notify(), and notifyAll() methods?
19 ► What is thread? What are the high-level thread states?OrWhat are the states associated in the thread?
20 ► What is deadlock?
21 ► How does multithreading take place on a computer with a single CPU?
22 ► What are synchronized methods and synchronized statements?
23 ► Can Java object be locked down for exclusive use by a given thread?OrWhat happens when a thread cannot acquire a lock on an object?
24 ► What is the difference between the methods sleep() and wait()?
25 ► What is the difference between process and thread?
26 ► What is daemon thread and which method is used to create the daemon thread?
27 ► What do you understand by Synchronization?OrWhat is synchronization and why is it important?OrDescribe synchronization in respect to multithreading?OrWhat is synchronization?
28 ► When you will synchronize a piece of your code?
29 ► Why would you use a synchronized block vs. synchronized method?
30 ► What is an objects lock and which objects have locks?
31 ► What state does a thread enter when it terminates its processing?
32 ► How would you implement a thread pool?
33 ► Is there a separate stack for each thread in Java?
34 ► What is the SwingUtilities.invokeLater(Runnable) method for?
35 ► What is the volatile modifier for?
36 ► Which class is the wait() method defined in?
37 ► What is a green thread?
38 ► What is a working thread?
- Ads By Google