What is difference between intrinsic synchronization and explicit locking using Lock?

In this blog post we will discuss about one of the very important java interview question What is difference between intrinsic synchronization and explicit locking using Lock?  Intrinsic synchronization Explicit Locking using Lock and Condition It is not possible to interrupt a thread waiting to acquire a lock, or attempt to acquire a lock without being… Read More »

What will happen when an exception arises from within a synchronized code block? Will lock be retained or released?

In this blog post we will discuss about one of the very important java interview question  What will happen when an exception arises from within a synchronized code block? Will lock be retained or released?  When an exception occurs from within a synchronized code block, then JVM smartly releases all the locks acquired by the current… Read More »

What is fail fast and fail-safe iterator in java?

In this blog post we will discuss about one of the very important java interview question What is fail fast and fail-safe iterator in java? Fail-Fast Iterator Iterator fails as soon as it realizes that the structure of the underlying data structure has been modified since the iteration has begun. Structural changes mean adding, removing any… Read More »

What is difference between Callable and Runnable Interface?

In this blog post we will discuss about one of the very important java interview question What is difference between Callable and Runnable Interface?  The java.util.concurrent.Callable interface is similar to java.lang.Runnable to create a custom threads and  both are designed for classes whose instances are potentially  executed by another thread. A Runnable, however, does not return… Read More »