fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.stream.*;
  4.  
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args)
  10. {
  11. try {
  12. IntStream.range(1, 10).filter(null);
  13. } catch (NullPointerException e) {
  14. System.out.println("We got a NullPointerException as null was passed as an argument to filter()");
  15. }
  16. }
  17. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
We got a NullPointerException as null was passed as an argument to filter()