Académique Documents
Professionnel Documents
Culture Documents
class TestTh
package hilos;
class TestTh extends Thread {
private String nombre;
private int retardo;
// Constructor para almacenar nuestro nombre y el retardo
public TestTh( String s, int d ){
nombre = s;
retardo = d;
}
public void run(){
// Retasamos la ejecucin el tiempo especificado
try{
sleep( retardo );
} catch( InterruptedException e ) { ; }
// Ahora imprimimos el nombre
System.out.println( "Hola Mundo! "+nombre+" "+retardo );
}
}
Pantallas ejecucin