Example of multithreading in Java