The document is a Java program that demonstrates the use of futures with an ExecutorService to fetch names concurrently. It creates four tasks to fetch names and submits them to a fixed thread pool. The program retrieves and prints the results of each task before shutting down the service.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views1 page
Code2pdf 67631fd8cea11
The document is a Java program that demonstrates the use of futures with an ExecutorService to fetch names concurrently. It creates four tasks to fetch names and submits them to a fixed thread pool. The program retrieves and prints the results of each task before shutting down the service.
System.out.printf("\nFull Name is: %s", name1.get());
System.out.printf("\nFull Name is: %s", name2.get()); System.out.printf("\nFull Name is: %s", name3.get()); System.out.printf("\nFull Name is: %s", name4.get());