Publicis Sapient interview question

why do we need locks in java multithreading?