2017-05-20 2 views

Antwort

2
val executor = Executors.newFixedThreadPool(5) 
    for (i in 0..9) { 
     val worker = Runnable { println("Hello this is thread " + i) } 
     executor.execute(worker) 
    } 
    executor.shutdown() 
    while (!executor.isTerminated) { 
    } 
    println("Finished all threads") 
Verwandte Themen