Part 4: Print Even and Odd Numbers Using 2 Threads in Java | Inter thread communication

preview_player
Показать описание
Given an integer N, the task is to write Java Program to print the first N natural numbers in increasing order using two threads.
Output:
Odd Thread - 1
Even Thread - 2
Odd Thread - 3
Even Thread - 4
Odd Thread - 5
Even Thread - 6
Odd Thread - 7
Even Thread - 8
Odd Thread - 9
Even Thread - 10

The idea is to create two threads and print even numbers with one thread and odd numbers with another thread

*****************************
Difficulty: Medium
Topic: Multithreading
DS: Threading
Company: MNC
*****************************

► Multi-Threading Complete Playlist:

[IMPORTANT]

#technicalinterview #codinginterview #crackingthetechnicalinterview

►►Additional Tags:
print even and odd numbers using 2 threads,
java multithreading,
java multithreading tutorial,
java multithreading interview questions,
print odd and even,
print odd and even numbers using thread in java,
print even and odd numbers using two threads in java,
print even and odd numbers using two threads
print odd and even numbers using threads java
print odd and even numbers using 2 threads in java
print odd and even numbers using two threads in c
java program to print odd and even numbers using two threads
print odd and even numbers using threads java
what is multithreading in java
multithreading in java
multithreading operating system
multithreading in java by durga sir,
multithreading in java interview questions,
multithreading in java telusko,
multithreading in java by deepak sir,
multithreading in java by ratan,
multithreading in java animation,
multithreading in java advanced,
multithreading in java all methods,
multithreading in java by telusko,
multithreading in java code,
multithreading in java coding questions,
multithreading in java code project,
concurrency and multithreading in java,
complete multithreading in java,
multithreading in java durgasoft,
multithreading in java dzone,
multithreading in java deadlock,
multithreading enhancement in java by durga sir,
multithreading in java edureka,
multithreading in java example program,
multithreading in java full,
multithreading in java for beginners,
multithreading in java full course,
multithreading in java for experienced,
multithreading in java geeksforgeeks,
thread and multithreading in java in hindi,
multithreading in java interview,
multithreading in java oracle,
implementation of multithreading in java,
multithreading concepts in java,
multithreading in java real life example,
Рекомендации по теме
Комментарии
Автор

Loved this playlist, bhut achha se samjhaye ho bhai . You are Awesome.

sanjeevgupta
Автор

Thanks for the information! Please make video on how to solve the DSA problem how to thik what should be the first Idea. Even after solving 150+ Q not feeling comfortable in DSA

yatri
Автор

Hi Bro, I have one doubt .Why we are using i<=10 in the for loop run method. Because we need to print numbers from 1 to 20 right

vigneshsivashanmugam
Автор

putting static counter is not printing thread sequentially it print different values everytime

purvee
Автор

While doing in vs code it's not running when I am writing static int counter =1;...aap sidha sidha problem solve kyun nhi karte hai...itna ghuma phira k kyun karte hai....😢😢😢

SUBHANKARDEY-jixs