title: java scanner's same-exact-inputs are not equal (for me?)
body: <p>I want to compare three couples of input from <code>Scanner</code> (just a quick test)
  by using the <code>Compare</code> method.</p>
  
  <p>When I run this program, it returns <code>false</code> for all three inputs even though there should be a <code>true</code> in between. When I remove <code>Scanner</code> and put in a <code>String</code> myself, I get the correct result</p>
  
  <p>First I thought that it's caused by the extra "Enter" button that stays in the buffer, but when I debugged it, there's nothing unwanted in the buffer
  and an extra call for input won't do any help.</p>
  
  <pre><code>import java.util.Scanner; 
  
   public class MainSector {
      String Primary, Secondary;
  
      MainSector(String Primary, String Secondary){
          this.Primary = Primary;
          this.Secondary = Secondary;
      }
  
  MainSector(int Primary, int Secondary) {
      this.Primary = String.valueOf(Primary);
      this.Secondary = String.valueOf(Secondary);
      }
  
  boolean Compare(MainSector x){
      return (x.Primary == Primary &amp;&amp; x.Secondary == Secondary );
  
      }
  
  }
  
  
  public class Test {
      public static void main(String[] args) {
          Scanner u = new Scanner(System.in);
          Scanner y = new Scanner(System.in);
  
          System.out.println("Enter String:");
          MainSector Sector1 = new MainSector(u.nextLine(),y.nextLine());
  
          System.out.println("Enter String:");
          MainSector Sector2 = new MainSector(u.nextLine(),y.nextLine());
  
          System.out.println("Enter Integer:");
          MainSector Sector3 = new MainSector(u.nextInt(),y.nextInt());
  
  
          System.out.println(Sector1.Compare(Sector2));
          System.out.println(Sector1.Compare(Sector3));
          System.out.println(Sector2.Compare(Sector3));
  
  
      }
  }
  </code></pre>
  
  <p>It returns <code>false</code> three times here even if the first two inputs are exactly the same. For example, I get the correct result with this:</p>
  
  <pre><code>System.out.println("Enter String:");
  MainSector Sector1 = new MainSector("aa","bb");
  
  System.out.println("Enter String:");
  MainSector Sector2 = new MainSector("aa","bb");
  
  System.out.println("Enter Integer:");
  MainSector Sector3 = new MainSector(45,65);
  </code></pre>
  
  <p>It returns:</p>
  
  <p><code>true</code> </p>
  
  <p><code>false</code> </p>
  
  <p><code>false</code></p>