Java - The Simplest solution using synchronized
java\nclass DiningPhilosophers {\n\n    private static final int COUNT = 5;\n\n    private int current = 0;\n\n    public synchronized void wantsToEat(\n       
```java\nclass DiningPhilosophers {\n\n    private static final int COUNT = 5;\n\n    private int current = 0;\n\n    public synchronized void wantsToEat(\n            int philosopher,\n            Runnable pickLeftFork,\n            Runnable pickRightFork,\n            Runnable eat,\n            Runnable putLeftFork,\n            Runnable putRightFork\n    ) throws InterruptedException {\n        while (current != philosopher) {\n            wait();\n        }\n        pickLeftFork.run();\n        pickRightFork.run();\n        eat.run();\n        putLeftFork.run();\n        putRightFork.run();\n        current = (current + 1) % COUNT;\n        notifyAll();\n    }\n}\n```
['Java']