• Post Reply Bookmark Topic Watch Topic
  • New Topic

What exctly the Future class in concurrent package of util?  RSS feed

 
Mitesh Soni
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain the use of Future class with some simple example.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is kind of similar to a Thread (or Runnable) in that it executes a chunk of code in a separate thread. But it also can return a result, and it can be cancelled while it's running - Runnable has neither of these features.
 
Mitesh Soni
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have explained callable, please explain Future with example
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think otherwise, but you don't have to take my word for it: a quick read of the javadocs will settle the question. java.util.concurrent.Callable java.util.concurrent.Future
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!