MCPcopy Create free account
hub / github.com/careercup/ctci / main

Method main

java/Chapter 16/Question16_3/Question.java:14–30  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

12 }
13
14 public static void main(String[] args) {
15 Chopstick[] chopsticks = new Chopstick[size + 1];
16 for (int i = 0; i < size + 1; i++) {
17 chopsticks[i] = new Chopstick();
18 }
19
20 Philosopher[] philosophers = new Philosopher[size];
21 for (int i = 0; i < size; i++) {
22 Chopstick left = chopsticks[leftOf(i)];
23 Chopstick right = chopsticks[rightOf(i)];
24 philosophers[i] = new Philosopher(i, left, right);
25 }
26
27 for (int i = 0; i < size; i++) {
28 philosophers[i].start();
29 }
30 }
31
32}

Callers

nothing calls this directly

Calls 2

leftOfMethod · 0.95
rightOfMethod · 0.95

Tested by

no test coverage detected