I am really new to Java, and I was following a book tutorial on how to read user input. Their code was...
class Example {
    public static void main(String args[]) throws java.io.IOException {
        // System.out.println()
        char ch;
        System.out.print("Press a key followed by ENTER: ");
        ch = (char) System.in.read();
        System.out.println("Your key is: " + ch);
    }
}
I tried to experiment and read user input as an integer like this...
class Example {
    public static void main(String args[]) throws java.io.IOException {
        int foo;
        System.out.print("Enter a number: ");
        foo = (int) System.in.read();
        System.out.print("Your number was: " + foo);
    }
}
However, upon typing for example number 12, I get the output as 49. Why is that? How come the book tutorial worked then?
EDIT: When I type in 'w' in my program, it still prints out 119. Surely I thought the throws thing was dealing with that? Or is it not?
And what is a Scanner (just saw it in the comments)?
 
     
    