Skip to content

Instantly share code, notes, and snippets.

@cerealcable
Created June 23, 2011 16:18
Show Gist options
  • Save cerealcable/1042893 to your computer and use it in GitHub Desktop.
Save cerealcable/1042893 to your computer and use it in GitHub Desktop.
Null tests
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<Object,Object> map;
if(map == null) {
System.out.println("test");
}
}
}
/**
* The attempt a compilation
javac Main.java
Main.java:9: variable map might not have been initialized
if(map == null) {
^
1 error
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment