How to read an int from the console in a beginner-friendly way?
<p>I'm helping someone learn Java at the moment. I'm a senior C# developer. I understand programming in general but I do not know the Java APIs.</p>

<p>Most advice on the web on how to read an int from the console is complicated. It involves <code>BufferedReader</code> and <code>InputStreamReader</code> and such. This is completely incomprehensible to a beginner.</p>

<p>I want to provide him with a function <code>static int readIntFromConsole()</code> that does this. What would the body of that function be?</p>