Publicis Sapient Interview Question

why do we need locks in java multithreading?