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

Method eat

java/Chapter 16/Question16_3/Philosopher.java:18–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16 }
17
18 public void eat() {
19 System.out.println("Philosopher " + index + ": start eating");
20 if (pickUp()) {
21 chew();
22 putDown();
23 System.out.println("Philosopher " + index + ": done eating");
24 } else {
25 System.out.println("Philosopher " + index + ": gave up on eating");
26 }
27 }
28
29 public boolean pickUp() {
30 pause();

Callers 1

runMethod · 0.95

Calls 3

pickUpMethod · 0.95
chewMethod · 0.95
putDownMethod · 0.95

Tested by

no test coverage detected