The first thread shows proper result, but it seems to run infinitely after that, i cant really get where is the mistake in the code, tried to put currentThread.join() method in other places but its not helping.