title: how can i use java scanner in while loop
body: <p>This is what I have so far:</p>
  
  <pre><code>int question = sc.nextInt(); 
  
  while (question!=1){
  
      System.out.println("Enter The Correct Number ! ");
  
      int question = sc.nextInt(); // This is wrong.I mean when user enters wrong number the program should ask user one more time again and again until user enters correct number.
      // Its error is : duplicate local variable
  
  }
  </code></pre>