1public int getScore(Map<String, Integer> scores, String name) {
2 Integer value = scores.get(name);
3 return value;
4}
no lines flagged
#059PracticeEasy8 min · 50 XP
Unboxing Null Integer Throws NPE
This method crashes with a NullPointerException when the map lookup misses, due to autoboxing.
Flagged linesNo lines flagged yet
What's wrong?
Flag a line or write a note to submit.