Top 100+ Advanced Multithreading Interview Questions 2019-2020 - 4

Question: 16

What is Future Task Class?

Future Task is the base implementation class of Future interface and we can use it with Executors for asynchronous processing. Most of the time we don’t need to use FutureTask class but it comes real handy if we want to override some of the methods of Future interface and want to keep most of the base implementation.

Question: 17

What is atomic operation?

Atomic operations are performed in a single unit of task without interference from other operations. Atomic operations are necessity in multithreaded environment to avoid data inconsistency.

Question: 18

What object does static synchronized methods use for locking?

Static synchronized methods synchronize on the class object (this.getClass()) of the class.

Question: 19

What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?

When a task’s interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.

Related Questions