var asks the compiler to infer the type of the variable from the type of the initializer, and the natural type of 42 is int. So number will be an int. That is what the JLS example says:
var a = 1; // a has type 'int'
And I would be surprised if it worked any other way, when I write something like this, I definitely expect a primitive.
If you need a var as boxed primitive, you could do:
var x = (Integer) 10; // x is now an Integer