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

Method foo

java/Chapter 16/IntroductionSynchronizedBlocks/MyObject.java:4–14  ·  view source on GitHub ↗
(String name)

Source from the content-addressed store, hash-verified

2
3public class MyObject {
4 public void foo(String name) {
5 synchronized(this) {
6 try {
7 System.out.println("Thread " + name + ".foo(): starting");
8 Thread.sleep(3000);
9 System.out.println("Thread " + name + ".foo(): ending");
10 } catch (InterruptedException exc) {
11 System.out.println("Thread " + name + ": interrupted.");
12 }
13 }
14 }
15}

Callers 1

runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected