As of JDK 5, you can get NullPointerExceptions on weird places, such as

Map<String, Integer> lookupTable = new HashMap<String, Integer>();
int value = lookupTable.get("key");

Since there are no entries in the lookupTable, the get returns a null value. The unboxing of a null value throws a NullPointerException.

Leave a Reply

You must be logged in to post a comment.