Created
March 31, 2018 18:12
-
-
Save Agnishom/06941ba2560ea99fcc1d27ad2bc6ac2b to your computer and use it in GitHub Desktop.
Java Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) | |
| { | |
| int l = 3; | |
| Conveyor conveyor = new Conveyor(); | |
| Thread nonHazardous[] = new Thread[l]; | |
| Thread hazardous[] = new Thread[l]; | |
| //populate | |
| for (int i = 0; i < l; i++){ | |
| nonHazardous[i] = new Thread(new Item(conveyor, i*10, 3000, false)); | |
| hazardous[i] = new Thread(new Item(conveyor, i*10+9, 3000, true)); | |
| } | |
| //run | |
| for (int i = 0; i < l; i++){ | |
| hazardous[i].start(); | |
| nonHazardous[i].start(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment