In Java you have to specify of which type a variable has to be.
It then makes sure that one can't assign values of a different type to the variable.
Trying to assign a different value results in an error: "String can not be converted to int." for example.
How does the checking work?
Where are the information about the variable-type stored?
How does it work there?
As far as I know determines the type the way values are stored in memory?
Consequently: How can a variable change it's in weakly typed languages? The way of storage wouldn't match anymore.