title: Is it bad practice to call a method inside an if/else condition?
body: <p>Is it considered bad practice to do this:</p>
  
  <pre><code>Scanner scan = new Scanner(System.in);
  if(scan.nextInt() == 5) {                //testing if input is equal to 5
      System.out.println("input equals 5");
  }
  </code></pre>
  
  <p>What about:</p>
  
  <pre><code>Scanner scan = new Scanner(System.in);
  if(scan.nextInt() == scan.nextInt()) {    //testing if two inputted ints are equal to each other
      System.out.println("input1 equals input 2");
  }
  </code></pre>
  
  <p>I read somewhere that this can cause "unexpected results" but I don't know what was meant by that. I have tested this quite a bit and haven't run into anything unexpected.</p>