Printing additional line when using System.in.read()
<pre><code>public class DWDemo {
    public static void main(String args[]) throws java.io.IOException {

        char ch;

        do {
            System.out.print("Press a key followed by ENTER: ");
            ch = (char) System.in.read();
        } while (ch != 'S');
    }
}
</code></pre>

<p>Trying to learn java. It's a simple function however the result I get is</p>

<pre><code>Press a key followed by ENTER: D
Press a key followed by ENTER: Press a key followed by ENTER: G
Press a key followed by ENTER: Press a key followed by ENTER: E
Press a key followed by ENTER: Press a key followed by ENTER: F
Press a key followed by ENTER: Press a key followed by ENTER: S
</code></pre>

<p>System will print "Press a key followed by Enter:" twice in Intellij and in eclipse will print three times.</p>

<p>Please help!</p>