My junior asked me, "I was asked this question by a new graduate. By the way, why? " I tried to do it myself while saying that I should do it myself, so I summarized it.
When dealing with numbers in Java, it is int type by default, so Because it is necessary to explicitly indicate that it is a long to treat it as a long type (The integer value of a numeric literal is treated as an int type)
It was as expected. That's all there is to it, so I'll add something else that interests me.
For byte and short, only numerical values are OK However, if it exceeds the range, a compile error will occur as a matter of course.
I understand byte, but the reason why s is not attached to short is a mystery (I don't see the short itself so much ...)
The default decimal type is double type.
When dealing with float type, it is necessary to explicitly add F.
You can add D when dealing with double types (you don't have to, I've never seen it)
Scala Same as java
Python Until 2.5, it was necessary to add l or L in the case of long type like Java, After that, it seems that it is no longer necessary to be integrated
C Add l or L when dealing with long types of signed integers Add ul or UL when dealing with long types of unsigned integers
C++ Add ll or LL when dealing with long types of signed integers Add ull or ULL when dealing with long types of unsigned integers
C# Add l or L when dealing with long types of signed integers Add ul or UL when dealing with long types of unsigned integers
Recommended Posts