
Java
A NullPointerException is an exception thrown by the
Java Virtual Machine when you try to access a variable as if it were an object when it is contains null. For example, the following code would throw a NullPointerException:
String s;
if (s.charAt(0) == 'c') // this line throws NullPointerException
return "s[0] is 'c'";