Print in Order

Suppose we have a class: public class Foo { public void first () { print ( 'first' ); } public void second () { print ( 'second' ); } public void third () { print ( 'third' ); } } &hellip; and the same instance of Foo is passed to three different threads. Thread A will call first() , thread B will call second() and thread C will call third() . Design Foo such that second() is executed after…