Clase Thread - docencia de la ETSIT-URJC
Clase Thread - docencia de la ETSIT-URJC
Clase Thread - docencia de la ETSIT-URJC
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
public c<strong>la</strong>ss Hucha {<br />
private int ahorros = 0;<br />
public void mete ( int cantidad ) {<br />
ahorros = ahorros + cantidad;<br />
}<br />
public int ahorros () { return ahorros; }<br />
}<br />
public c<strong>la</strong>ss Ahorrador extends <strong>Thread</strong> {<br />
Hucha hucha;<br />
int iteraciones;<br />
public Ahorrador ( String nombre, Hucha hucha, int iteraciones ) {<br />
super (nombre);<br />
this.hucha = hucha;<br />
this.iteraciones = iteraciones;<br />
}<br />
public void run () {<br />
for (int i=1; i