fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. interface Lambda {
  8. int call() throws IOException;
  9. }
  10.  
  11. /* Name of the class has to be "Main" only if the class is public. */
  12. class Ideone
  13. {
  14. public static void main (String[] args)
  15. {
  16. Foo(() -> {
  17. throw new FileNotFoundException();
  18. });
  19. }
  20.  
  21. public static void Foo(Lambda x) {
  22. try {
  23. System.out.print(x.call());
  24. } catch (IOException ex) {
  25. ex.printStackTrace();
  26. }
  27. }
  28. }
Success #stdin #stdout #stderr 0.13s 4386816KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
java.io.FileNotFoundException
	at Ideone.lambda$main$0(Main.java:17)
	at Ideone.Foo(Main.java:23)
	at Ideone.main(Main.java:16)