How does java differentiate Callable and Runnable in a Lambda?
问题 I got this little code to test out Callable . However, I find it pretty confusing how the Compiler could know if the Lambda is for the Interface Callable or Runnable since both don't have any parameter in their function. IntelliJ, however, shows that the Lambda employs the code for a Callable. public class App { public static void main(String[] args) throws InterruptedException { ExecutorService executorService = Executors.newCachedThreadPool(); executorService.submit(() ->{ System.out