jfcmacro icon

CrearThread.java

jfcmacro | PRO | 03/26/19 09:55:42 PM UTC | 0 ⭐ | 361 👁️ | Never ⏰ | []
Java |

440 B

|

None

|

0 👍

/

0 👎

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