title: Why are 2 Long variables not equal with == operator in Java?
body: <p>I got a very strange problem when I'm trying to compare 2 Long variables, they always show false and I can be sure they have the same number value by debugging in Eclipse:</p>
  
  <pre><code>if (user.getId() == admin.getId()) {
      return true; // Always enter here
  } else {
      return false;
  }
  </code></pre>
  
  <p>Both of above 2 return values are object-type Long, which confused me. And to verify that I wrote a main method like this:</p>
  
  <pre><code>Long id1 = 123L;
  Long id2 = 123L;
  
  System.out.println(id1 == id2);
  </code></pre>
  
  <p>It prints true.</p>
  
  <p>So can somebody give me ideas?. I've been working in Java Development for 3 years but cannot explain this case. </p>