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. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10.  
  11. public static Object open() throws IOException {
  12. throw new IOException();
  13. }
  14.  
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17.  
  18. Object sChannel = null;
  19. try {
  20. sChannel = Ideone.open();
  21. } catch (IOException ex) {
  22. ex.printStackTrace();
  23. }
  24. System.out.println(
  25. "I know nothing about coding" +
  26. "and trying to use sChannel here" +
  27. "without checking if it is not null"
  28. + sChannel.toString());
  29. }
  30. }
Runtime error #stdin #stdout #stderr 0.1s 320320KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
java.io.IOException
	at Ideone.open(Main.java:12)
	at Ideone.main(Main.java:20)
Exception in thread "main" java.lang.NullPointerException
	at Ideone.main(Main.java:28)