I remember reading somewhere that local variables with inferred types can be reassigned with values of the same type, which would make sense.
var x = 5;
x = 1; // Should compile, no?
However, I'm curious what would happen if you were to reassign x
to an object of a different type. Would something like this still compile?
var x = 5;
x = new Scanner(System.in); // What happens?
I'm currently not able to install an early release of JDK 10, and did not want to wait until tomorrow to find out.