From 83c2b10efaa9438d1988c534b57d3f87e4bef732 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 9 Dec 2024 15:04:59 +0100 Subject: [PATCH] added ex A --- src/exercicses/ex_a/HelloRunnable.java | 8 ++++++++ src/exercicses/ex_a/HelloThread.java | 8 ++++++++ src/exercicses/ex_a/TestingSimpleThreads.java | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/exercicses/ex_a/HelloRunnable.java create mode 100644 src/exercicses/ex_a/HelloThread.java create mode 100644 src/exercicses/ex_a/TestingSimpleThreads.java diff --git a/src/exercicses/ex_a/HelloRunnable.java b/src/exercicses/ex_a/HelloRunnable.java new file mode 100644 index 0000000..2d76be3 --- /dev/null +++ b/src/exercicses/ex_a/HelloRunnable.java @@ -0,0 +1,8 @@ +package exercicses.ex_a; + +public class HelloRunnable implements Runnable { + @Override + public void run() { + System.out.println("Hello from a class implementing the Runnable interface"); + } +} diff --git a/src/exercicses/ex_a/HelloThread.java b/src/exercicses/ex_a/HelloThread.java new file mode 100644 index 0000000..4aa5ad7 --- /dev/null +++ b/src/exercicses/ex_a/HelloThread.java @@ -0,0 +1,8 @@ +package exercicses.ex_a; + +public class HelloThread extends Thread { + @Override + public void run() { + System.out.println("Hello from a class extending the Thread class"); + } +} diff --git a/src/exercicses/ex_a/TestingSimpleThreads.java b/src/exercicses/ex_a/TestingSimpleThreads.java new file mode 100644 index 0000000..ac93172 --- /dev/null +++ b/src/exercicses/ex_a/TestingSimpleThreads.java @@ -0,0 +1,8 @@ +package exercicses.ex_a; + +public class TestingSimpleThreads { + public static void main(String[] args) { + new HelloThread().start(); + new Thread(new HelloRunnable()).start(); + } +}