1l for long, 1f for float, 1d for double, but what about a byte?
long l = 1l; float f = 1f; double d = 1d; // byte b = 1?;
What is equivalent for byte ? He exists?
byte
No, there is no suffix that you can add to a numeric literal to make it byte .
See 3.10 Literals in the Java Language Specification.
You need to send in byte as follows:
byte b = 1; b = (byte) 5;
Since by default these numeric constants are treated as int in Java.
no suffix, you can add a numeric literal
There is no such suffix for bytes, see Java 3.10.1 Language Specification :
DecimalIntegerLiteral: DecimalNumeral IntegerTypeSuffix(opt) IntegerTypeSuffix: one of l L
Note (opt) means that it is optional. Therefore, for the assignment, you need to explicitly use with (byte) 1 .
(opt)
(byte) 1