• Get Thread Id in Java
    30 September

    Get Thread Id in Java

    In this article, we will learn to get thread id of a running thread in Java. An Id is a unique positive number generated at the time of thread creation. This id remains unchanged during the lifetime of the thread. When a thread gets terminated its id can be used to refer another thread, but […]

  • ArrayBlockingQueue in java
    19 September

    ArrayBlockingQueue in java

    In this article, we will understand the Java concurrent queue, BlockingQueue. We will then go deep into it’s one of the implementation, ArrayBlockingQueue. What is BlockingQueue BlockingQueue interface was introduced in Java 5 under concurrent APIs and it represents a thread-safe queue in which elements can be added to and removed from. We can have […]

  • Delay java program by few seconds
    11 December

    Java wait seconds or delay Java program for few secs

    In this post, we will see how to delay java program for few secs or wait for seconds for java program to proceed further. We need to delay a java programs in many situation where we want to wait for some other task to finish. There are multiple ways to delay execution of java program […]

  • wait(),notify() and notifyAll() in java
    22 October

    Why wait(), notify() And notifyAll() methods are in Object Class

    In this post, we will see why wait(), notify() And notifyAll() methods are in Object Class And Not in Thread Class. This is one of the most asked java multithreading interview questions. You might know that wait(), notify() And notifyAll() Methods are in Object class and do you know the reason for the same? Let’s […]

  • Custom BlockingQueue in java
    16 October

    Custom BlockingQueue implementation in java

    In this post, we will see how to create your own custom BlockingQueue. This is one of the most asked java interview questions. You need to implement your own BlockingQueue. This question helps interviewer to get your understanding of multithreading concepts. Here is simple implementation of BlockingQueue. We will use array to store elements in […]

  • Print sequence using 3 threads in java
    17 November

    Print sequence using 3 threads in java

    In this post, we will see how to print sequence using 3 threads in java.It is similar to printing odd-even numbers using two threads in java. Problem You are given 3 threads. You need to print sequence using these 3 threads.You need to print in natural order up to MAX. For example: Let’s say you […]

  • Difference between Runnable and Callable in java
    16 December

    Difference between Runnable and Callable in java

    Runnable and Callable interface both are used in the multithreading environment.Callable is available in java.util.concurrent.Callable package and Runnable in java.lang.Thread. Difference between Runnable and Callable interface in java Runnable was introduced in java 1.0 version While Callable is an extended version of Runnable and introduced in java 1.5 to address the limitation of Runnable. Runnable […]

  • Java Runnable
    24 September

    Java Runnable example

    In this post, we will see Java Runnable example. As you might know, there are two ways of creating threads in java. Extending thread class Implementing Runnable interface. As you can extend only one class in java, it is not possible to extend any other class if a class extends thread class.You can also implement […]

  • Multithreading interview questions in java
    16 February

    Java Multithreading and Concurrency Interview Questions

    In this tutorial, we are going to see Multithreading interview questions with answers. Here is list of Java Multithreading interview questions. Java multithreading interview questions 1. What is thread in java? Answer: Thread can be called as light weight process. It can be referred as smallest part of process which can be executed concurrently with […]