Supplying a task

Report a typo

Suppose you have an instance of ExecutorService.

val executor: ExecutorService = Executors.newSingleThreadExecutor()

The main thread supplies two tasks to it:

val task: Runnable = Runnable {
    try {
        TimeUnit.MILLISECONDS.sleep(1000)
        println("Hello!")
    } catch (e: Exception) {
        println(e.stackTraceToString())
    }
}

executor.submit(task)
executor.submit(task)

Select all correct statements:

Select one or more options from the list
___

Create a free account to access the full topic