Skip to content

Instantly share code, notes, and snippets.

@Agnishom
Created March 31, 2018 18:12
Show Gist options
  • Select an option

  • Save Agnishom/06941ba2560ea99fcc1d27ad2bc6ac2b to your computer and use it in GitHub Desktop.

Select an option

Save Agnishom/06941ba2560ea99fcc1d27ad2bc6ac2b to your computer and use it in GitHub Desktop.
Java Assignment
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