Posts

Showing posts with the label Core Java Interview

Java multithreading interview questions and answers

Image
If you are going for Java interviews to work on  large scale systems ,  expect multi-threading interview questions. These are more  beginner or fresher level  questions and if you are already good with the basics, try more intermediate  to  advanced  level coding questions and answers on Java multi-threading at  Java multi-threading-1   |    Java multi-threading-2   Q . What is the difference between processes and threads?  A . A process is an execution of a program but a thread is a single execution sequence within the process. A process can contain multiple threads. A thread is sometimes called a lightweight process.  A JVM runs in a single process and threads in a JVM share the heap belonging to that process. That is why several threads may access the same object. Threads  share the heap and have their own stack space . This is how one thread’s invocation of a method and its local variables are k...