scanner in java not working on my machine
<pre><code>public class CollectionTest {

    public static void main(String args[]) {

        //create Scanner instance to get input from User
        Scanner scanner = new Scanner(System.in);

        System.err.println("Please enter first number to add : ");
        int number = scanner.nextInt();

        System.out.println("Enter second number to add :");
        int num = scanner.nextInt();

        //adding two numbers in Java by calling method
       int result = add(number, num);

       System.out.printf(" Addition of numbers %d and %d is %d %n", number, num, result);
    }

    public static int add(int number, int num){
        return number + num;
    }
}
</code></pre>

<p>I wonder what's wrong with this code.When I run this program on my new laptop this works fine.
But on my old pc it gives some error.
Please help me out.Thnx in advance.d</p>
