unable to convert string to integer using parseInt()
<p>As a beginner I know that Integer.parseInt() is used to convert strings to integers but here I tried a program but its not working</p>

<pre><code>Public static void main(String args[])
{

    Scanner sr=new Scanner(System.in);
    String s=sr.nextLine();
    int i=Integer.parseInt(s);
    System.out.println(i);

}
</code></pre>

<p>I want to take a line as input and convert it into integers and print but while executing it show NumberFormatException</p>