Skip to main content
๐Ÿ› Bug HuntJV Java Mediumโšก+20 XP

NullPointerException

This code crashes with NPE.

๐Ÿ› Find the bug
1String s = null;
2if (s.equals("hello")) {
3 System.out.println("Match");
4}
๐Ÿ› The bug is on line 2

๐Ÿ”ง Select the correct fix: