Java thread Assignment