I guess that's a design decision of the
Java developers. In the same line of thinking, you could ask yourself these questions:
- Why are literals from -128 to 127 int literals and not byte literals?
- Why are literals from -32768 to 32767 (excluding those from -128 to 127) int literals and not short literals?
- Why do long literals need an L? Any literal outside the range of int but inside the range of long could be long automatically.
In other words, the type of integer literals could have been dynamic, based on the range. The developers decided not to do this but use int as the default type, for both literals and mathematical expressions. That's something you'll now have to live with.