Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
// }

ExecutorService executorService = Executors.newFixedThreadPool(2);
RandomNumberGenerator random1 = new RandomNumberGenerator();
RandomNumberGenerator random2 = new RandomNumberGenerator();
RandomNumberGenerator random1 = new RandomNumberGenerator<Integer>();
RandomNumberGenerator random2 = new RandomNumberGenerator<Integer>();

Future<Integer> randomNum1 = executorService.submit(random1);
Future<Integer> randomNum2 = executorService.submit(random2);
Expand All @@ -38,4 +38,4 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
System.out.println("Sum of random numbers : " + (num1 + num2) +
" THREAD: " + Thread.currentThread().getName());
}
}
}
2 changes: 1 addition & 1 deletion src/RandomNumberGenerator.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.util.Random;
import java.util.concurrent.Callable;

public class RandomNumberGenerator implements Callable {
public class RandomNumberGenerator implements Callable<Integer> {
@Override
public Integer call() throws Exception {
Random random = new Random();
Expand Down