Some Coding Challenges: Implementing a Lock.

2 min readMar 27, 2024

The challenge is to implement a lock in Java by only using synchronized, wait, notify as constructs.

The lock shall work as follows:

var lock = new Lock();

private void doSomething(){
// no other thread shall be able to go here in the meantime

A solution written in Java:




I am a Software Developer - Java, Rust, SQL, TypeScript - with strong interest doing research in pure and applied Mathematics.