Java 9 Interview Questions for 1,2,3,4,5,6,7,8,9,10 Years Experience - 1

Question: 1

Which method is used to create the daemon thread?

setDaemon method is used to create a daemon thread.

Question: 2

What is the class and interface in java to create thread and which is the most advantageous method?

Thread class and Runnable interface can be used to create threads and using Runnable interface is the most advantageous method to create threads because we need not extend thread class here.

Question: 3

What methods must be implemented by all threads?

All tasks must implement the run() method, whether they are a subclass of Thread or implement the Runnable interface.

Question: 4

What are the benefits of multithreaded programming?

In Multi Threaded programming, multiple threads are executing concurrently that improves the performance because CPU is not idle incase some thread is waiting to get some resources.

Multiple threads share the heap memory, so its good to create multiple threads to execute some task rather than creating multiple processes.

Question: 5

Which method must be implemented by all threads?

All tasks must implement the run() method.

Related Questions