future

The use of Future in java

The use of Future in java Future is an interface introduced in java 1.5 that can be used to get asynchronous results easily. This article will explain how to use Future through specific examples. Creating Future As mentioned above, Future represents the result of asynchronous execution, which means that when the asynchronous execution is finished, the returned result will be saved in Future. So when do we use Future? Generally speaking, when we execute a long-running task, using Future allows us to temporarily deal with other tasks, and then return the result when the long task is finished.