In java, the default integer type is int. Java will automatically rise (for example, from shortto int), but it will issue a warning with a decrease (for example, from intto short) due to possible data loss.
The fix for your code is:
doInt((short)99);
This explicit downcast changes 99(which is int) to short, so there is no (optional) possible data loss.
source
share