Java What is a deadlock and how can it be avoided ? A deadlock in computer science refers to a situation in multithreaded or multi-process systems where two or…