square_cube_thread.java - Write a Java program that implements a multi-threaded program which has three threads. First thread generates a random integer every 1 second. If the value is even, second thread computes the square of the number and prints. If the value is odd the third thread will print the value of cube of the number.
How Many Random Integers needed : 5
Set the limit upto which random numbers should be generated : 10
The random integer: 3
Cube of 3 = 27
The random integer: 1
Cube of 1 = 1
The random integer: 2
Square of 2 = 4
The random integer: 9
Cube of 9 = 729
The random integer: 2
Square of 2 = 4
banking.java - Write a Java program that simulate a banking environment using all the cases thread synchronization concept( synchronisation method, synchronization block, static synchronization, inter-process communication.
Going to Withdraw...
Going to Withdraw..
Going to deposit
Deposit completed..
Withdraw completed
odd_even_thread.java - Write a Java program to create two threads: One for displaying all odd number between 1 and 100 and second thread for displaying all even numbers between 1 and 100.
Odd Numbers : 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
Even Numbers : 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100