179 Passaggio di parametri tra Thread Scrittura delle classi pi.java e po.java public class pi extends Thread{ z buf; pi(z buf){ this.buf=buf; } public void run(){ while(true) { try{ Thread.sleep(800);} catch(InterruptedException e) {} System.out.print( leggo ); for (int i=0; i<5; i++) System.out.print( +buf.get(i)); System.out.println(); } class po extends Thread{ z buf; Random r=new Random(); po(z buf){ this.buf=buf; } public void run(){ while(true) { try{ Thread.sleep(990);} catch (InterruptedException e){} System.out.print( \tscrivo ); for(int i=0; i<5; i++) { buf.put(i,r.nextFloat()); System.out.print( +buf.get(i)); } System.out.println(); }
{}