enar wang wrote:By testing the sample questions at Wiley, I noticed that the IDE complains that ExecutorService must be final or effectively final, so that all the examples in our book must make a temp final copy of previous 'service' to let it compile and run?
If you are using "service" inside a lambda in the forEach statement, then it must be effectively final. You initialized "service" to null, and then you assign it to Executors.newSingleThreadExecutor(), so that means it is no longer effectively final.