BNP Paribas Interview Question

What's Optimistic and Pessimistic Lock in Java?