Skip to content

Instantly share code, notes, and snippets.

@gbajaj
Created July 8, 2019 20:42
Show Gist options
  • Save gbajaj/d4da1f80c7f71effe8d0bc5e056f82b6 to your computer and use it in GitHub Desktop.
Save gbajaj/d4da1f80c7f71effe8d0bc5e056f82b6 to your computer and use it in GitHub Desktop.
Comparing Integers Right Way
public class Main {
public static void main(String[] args) {
Integer a = new Integer(10);
Integer b = new Integer(10);
if (a.equals(b)) {
System.out.println("true");
} else {
System.out.println("false");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment