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

Method foo

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

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected