Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package bakery;
- public class Bakery {
- static int x;
- static int y;
- public static void main(String[] args) {
- try {
- for (int j = 0; j < 10; j++) {
- x = 0;
- y = 0;
- int tab[] = new int[10];
- for(int m=0;m<10;m++) {
- tab[m] = m++;
- }
- int tabMIN[] = new int[5];
- int tabMAX[] = new int[5];
- Thread t1 = new Thread() {
- public void run() {
- /*
- x = 1;
- int min = tab[0];
- for(int lm=0;lm<100;lm++) {
- for (int i = 0; i < 10; i++) {
- if(min>tab[i]) {
- min = tab[i];
- }
- y = 1;
- }
- } */
- for(int m1=0;m1<5;m1++) {
- System.out.println(m1+" zbiór mniejszych liczb");
- }
- }
- };
- Thread t2 = new Thread() {
- public void run() {
- /*
- int ly = y;
- int lx = x;
- System.out.println("Thread 2: y = " + ly + ", x = " + lx);
- */
- for(int m2=5;m2<10;m2++)
- System.out.println(m2+" zbiór większych liczb");
- }
- };
- t1.start();
- t2.start();
- t1.join();
- t2.join();
- }
- } catch (InterruptedException e) { }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement