-
-
Save manuelaplesa96/c79fec432a7ed1d1b2a62b1b8f3aeb09 to your computer and use it in GitHub Desktop.
The gist that shows an example of an NPE in the Java programming language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
User user = null; | |
System.out.println(user.name); // Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:3) | |
} | |
} | |
class User { | |
String name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment