class CrearThread extends Thread {
public CrearThread() {
super();
}
public void run() {
for (int i = 0; i < 10; ++i) {
System.out.println("Hilo: " + Thread.currentThread());
}
}
public static void main(String args[]) {
CrearThread t1 = new CrearThread();
CrearThread t2 = new CrearThread();
t1.start();
t2.start();
try {
t1.join();
t2.join();
}
catch (InterruptedException ie) { }
}
}
Comments