title: java while loop error? additional outputs what is the wrong with the code?
body: <pre><code>class demoWhile{        
  public static void main(String args[])
      throws java.io.IOException{
          char ch = (char)System.in.read();
          while(ch!='w'){
              System.out.println("Hi"+ch);
              ch = (char)System.in.read();
          }
      }
  }
  </code></pre>
  
  <p>-first I gave the input a 'r' and expected output was "Hir" then input option but instead received output was Hir, Hi, Hi then the input option. why it shows two additional Hi, Hi?</p>