Exercises in multithreaded Java