Commit eb08b7f8 authored by rawan's avatar rawan

step5

parent 0d2187ec
package hacker;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
//create the Vault
Vault vault = new Vault();
List<Thread> threads = new ArrayList<>();
//Create Hackers and pass the previously created vault to them
AscendingHackerThread ascHacker = new AscendingHackerThread(vault);
DescendingHackerThread descHacker = new DescendingHackerThread(vault);
PoliceThread police = new PoliceThread();
threads.add(ascHacker);
threads.add(descHacker);
threads.add(police);
ascHacker.setPriority(Thread.MAX_PRIORITY);
descHacker.setPriority(Thread.MAX_PRIORITY);
System.out.println("start");
for (Thread t : threads) {
//t.start :Makes the three Threads start executing together in parallel
t.start();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment