INNER CODE UNIT · Java

bowBack

AlmasB/FXTutorials · src/main/java/com/almasb/Deadlock.java:20

        public synchronized void bowBack(Friend bower) {
            System.out.format("%s: %s" + " has bowed back to me!%n",
                    this.name, bower.getName());
        }
    }

    public static void main(String[] args) {
        Friend alphonse = new Friend("Alphonse");
        Friend gaston = new Friend("Gaston");

        new Thread(() -> alphonse.bow(gaston)).start();
        new Thread(() -> gaston.bow(alphonse)).start();
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…