dhulmul
dhulmul

Reputation: 750

What is a Task in Java?

Java supports application to run asynchronous tasks through various mechanisms, what exactly is a task? JavaDocs: https://docs.oracle.com/javase/tutorial/essential/concurrency/index.html

Upvotes: 3

Views: 20103

Answers (1)

Kayaman
Kayaman

Reputation: 73568

Task is just a unit of work in the abstract sense. You have tasks of some type, and then you have mechanisms to perform those tasks in an asynchronous way.

A simple example would be instances of Runnable or Callable (or even FutureTask if you want to have the name "task" in it) for the tasks, and an ExecutorService to run them.

Upvotes: 8

Related Questions