diff --git a/src/exercicses/ex_b/SleepMessages.java b/src/exercicses/ex_b/SleepMessages.java new file mode 100644 index 0000000..59e00c2 --- /dev/null +++ b/src/exercicses/ex_b/SleepMessages.java @@ -0,0 +1,28 @@ +package exercicses.ex_b; + +public class SleepMessages implements Runnable { + public String[] song = { + "Georges Brassens (1964) - Les Copains d'abord", + "Non, ce n'était pas le radeau", + "De la Méduse, ce bateau", + "Qu'on se le dise au fond des ports", + "Dise au fond des ports", + "Il naviguait en père peinard", + "Sur la grand - mare des canards", + "Et s'appelait les Copains d'abord", + "Les Copains d'abord" + }; + + + @Override + public void run() { + for (String msg : song) { + try { + Thread.sleep(1000); + System.out.println(msg); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } +} diff --git a/src/exercicses/ex_b/TestingSleep.java b/src/exercicses/ex_b/TestingSleep.java new file mode 100644 index 0000000..b83072e --- /dev/null +++ b/src/exercicses/ex_b/TestingSleep.java @@ -0,0 +1,7 @@ +package exercicses.ex_b; + +public class TestingSleep { + public static void main(String[] args) { + new Thread(new SleepMessages()).start(); + } +}