Please, note that Scanner is locale-aware. It interprets numeric values according to the configured (or default) locale.
I tried your code and since my system has the Italian locale as default, I...