Multithreading
30 SeptemberGet 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 […]
19 SeptemberArrayBlockingQueue 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 […]
11 DecemberJava 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 […]
29 MayHow to print even and odd numbers using threads in java
In this post, we will see how to print even and odd numbers using threads in java. see also: How to print sequence using 3 threads in java Problem You are given two threads. You need to print odd numbers using one thread and even numbers using another thread.You need to print in natural order […]
22 OctoberWhy 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 […]
16 OctoberCustom 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 […]
16 DecemberDifference 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 […]
17 NovemberPrint Numbers Using Multiple Threads in Java
In this post, we will see how to print numbers using multiple 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 […]
24 SeptemberJava 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 […]
- 1
- 2
- 3
- …
- 5
- Nextkeyboard_arrow_right