Question: a) Write a Java program to implement two child threads such that one thread prints prime numbers from 1 to 100 and the other thread

a) Write a Java program to implement two child threads such that one thread prints prime numbers from 1 to 100 and the other thread prints non-prime numbers from I to 100 (use Thread class). Note: Each thread has a delay of 500 milliseconds after printing one number. b) What will be lhe output of the following Java code? Please explain how you got the output. class Testtry { public static int b; public static void main(String args() { for (int a=0; x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
