title: Why does comparison of two integers of MAX_VALUE fail in java?
body: <p>I have the following lines of code in Java:</p>
  
  <pre><code>public class myProjects {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      Integer d = Integer.MAX_VALUE;
      Integer e = Integer.MAX_VALUE;
      System.out.println(d);
      System.out.println(e);
      if(d == e){
          System.out.println("They are equal\n");
  
      }else {
          System.out.println("They are not equal\n");
      }
  }
  
  }
  
  Output:
  2147483647
  2147483647
  They are not equal
  </code></pre>
  
  <p>Why are they not equal even though they have the same value?</p>