if (randInt % 5 == 0) {
if (randInt % 5 != 0) // what is need of this line, please explain...
System.out.println(randInt);
}
if (randInt % 5 == 0) {
if (randInt % 5 != 0) // what is need of this line, please explain...
System.out.println(randInt);
}
@Bibek_Dey The below line of code seems to be useless if the code is single-threaded.
But multithreading adds spice to it because there is a possible scenario that right before executing this line of code, the context switches, and another thread changes the value of randInt
and at that point, this very condition might be true.