It does not compile, it produces "incompatible types: the scanner cannot be converted to int". Local type inference does not change the static typing of Java. In other words:
var x = 5;
x = new Scanner(System.in);
is just syntactic sugar for:
int x = 5;
x = new Scanner(System.in);