Category: Java Multithreading

Collection of Java Multithreading interview questions and answers with example and notes asked in IT Industries.

Awesome Answer for Extending Thread Class vs Implementing Runnable interface in Java

Very nice and concise answer with examples for technical interview question what difference between Extending Thread class and Implementing Runnable Interface in Java. Before answering the differences lets have a brief note and tips that will help you answer the best. Examples of creating threads in java using extending Thread class and Runnable Interface NOTE:…

Read the full article

What is thread pool in Java? Explain with a scenario and code.

Answer includes thread pool in java with concept and one simple scenario example and program, where thread pool can be used. Answer: Thread pool is collection of multiple threads that is used to performed large number of tasks simultaneously. Tried to include multiple scenarios for better understating and answering the concept with one scenario is…

Read the full article

What is Synchronization in Java and why it is important?

Answer includes about what is synchronization in java multithreading and when do we use it or why it is important. Synchronized meaning, concept and program example explained with or without synchronization. This concept will help understand why to use thread synchronization in java multithreading. Answer: What is synchronization in java? Synchronization in java multithreading is…

Read the full article

Java Thread Interview Questions and Answers | Short – Real

This section contains java multi threading real short interview questions and answers asked in IT industries to freshers and experienced. Generally, this kind of questions are asked in software job interview questions to judge candidate skills over multiple areas in the subject in short span of time. Q-Which method must be implemented by all java…

Read the full article

Difference between process and thread in Java Multithreading?

Answer:Difference between process and thread in java multithreading listed below is applied to all languages i.e. Java, C, C++ and C# etc. Here are 4 major important differences are described. 1)Processes are heavy-weight and threads are light-weight. Heavy –weight: each process shares different virtual address space. Light-weight: each thread shares same virtual space. Means, threads…

Read the full article

What is difference between start and run in Java Thread?

Answer includes the difference between start and run Describing the interview question, difference between run and start method in Java multithreading with example. But, also note that this question can also be asked as  below “if start() method eventually call run() method in a thread then why don’t we call run() method directly?” Answer: Thread.start()…

Read the full article

What happens if we don’t override run() method during thread creation using extended thread?

Answer: If we don’t override run() method, compiler will not flash any error and it will execute run() method of Thread class that has empty implemented, So, there will be no output for this thread. Below example will not provide any output     Notes: This is one of the advantages of Runnable interface over…

Read the full article