/src/ThreadsSynchronization/Sender.java

https://bitbucket.org/Marin_Abaluta/exercitiul_15 · Java · 23 lines · 14 code · 9 blank · 0 comment · 0 complexity · 04ef62ca9e3f2225c1458fd510c10493 MD5 · raw file

  1. package ThreadsSynchronization;
  2. import com.sun.org.apache.xpath.internal.SourceTree;
  3. public class Sender {
  4. public void send(String message) {
  5. System.out.println("Sending " + message);
  6. try {
  7. Thread.sleep(1000);
  8. } catch (InterruptedException x) {
  9. System.out.println("Interrupted");
  10. }
  11. System.out.println(message);
  12. System.out.println("Sent");
  13. }
  14. }