In Java, integer literals are int if they do not have the letter βLβ or βlβ (capital L is preferred because lowercase L is difficult to distinguish from number 1). If the suffix is ββwith L, literals are of type long.
The suffix does not have a special name in the Java Language Specification. There are also no suffixes for any other integer types. Therefore, if you need a short or byte literal, they should be stripped:
byte foo = (byte)0; short bar = (short)0;
In setLongValue (100L), you do not have to include the L suffix, because in this case int literal automatically expands to a long one. This is called the extension of primitive conversion to the Java language specification.
Lauri Feb 19 2018-10-19T00 : 00Z
source share