BNP Paribas interview question

What's Optimistic and Pessimistic Lock in Java?