Skip to content

Instantly share code, notes, and snippets.

@agiliq
Created July 15, 2009 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agiliq/147932 to your computer and use it in GitHub Desktop.
Save agiliq/147932 to your computer and use it in GitHub Desktop.
public class Test{
public static void main(String[] args){
//System.out.println(null);
//System.out.println(null > 10);
//System.out.println(null < 10);
System.out.println(null == null);
System.out.println(10 == 10);
}
}
$ javac Test.java
$ java Test
true
true
public class Test{
public static void main(String[] args){
//System.out.println(null);
System.out.println(null > 10);
System.out.println(null < 10);
System.out.println(null == null);
System.out.println(10 == 10);
}
}
$ javac Test.java
Test.java:4: operator > cannot be applied to <nulltype>,int
System.out.println(null > 10);
^
Test.java:5: operator < cannot be applied to <nulltype>,int
System.out.println(null < 10);
^
2 errors
public class Test{
public static void main(String[] args){
//System.out.println(null);
//System.out.println(null > 10);
//System.out.println(null < 10);
System.out.println(null == 10);
System.out.println(null == null);
System.out.println(10 == 10);
}
}
Test.java:6: incomparable types: <nulltype> and int
System.out.println(null == 10);
^
1 error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment