Thread implementation in JAVA.