Do anybody know why does this Exception is being thrown?
PHP Code:
public class DiningPhilosopher {
public static void main(String[] args) {
Chopstick cs = new Chopstick();
Philosopher p1 = new Philosopher(cs, cs, 1);
Philosopher p2 = new Philosopher(cs, cs, 2);
Philosopher p3 = new Philosopher(cs, cs, 3);
Philosopher p4 = new Philosopher(cs, cs, 4);
Philosopher p5 = new Philosopher(cs, cs, 5);
p1.start();
p2.start();
p3.start();
p4.start();
p5.start();
}
}
I don't see there's anything wrong in my codes...
Error Message:
Code:
Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Unknown Source)
at DiningPhilosopher.main(DiningPhilosopher.java:10)