/src/ThreadsSynchronization/SynchronizationTest.java

https://bitbucket.org/Marin_Abaluta/exercitiul_15 · Java · 24 lines · 16 code · 8 blank · 0 comment · 0 complexity · b071576cd6f2a8f9baa15e3a98f3919b MD5 · raw file

  1. package ThreadsSynchronization;
  2. public class SynchronizationTest {
  3. public static void main(String[] args) {
  4. Sender snd = new Sender();
  5. ThreadedSend t1 = new ThreadedSend(snd, "Hi Terry Williams");
  6. ThreadedSend t2 = new ThreadedSend(snd, "We hope you enjoy the stay at our hotel!");
  7. t1.start();
  8. t2.start();
  9. try {
  10. t1.join();
  11. t2.join();
  12. } catch (InterruptedException e) {
  13. e.printStackTrace();
  14. }
  15. }
  16. }