You can not parse the String: "Sam" to an int value.
To see what the code is doing, add a println statement that prints out every line that is read so you can see what the program sees.

Check...