Java – what is 1L for long, 1F for float, 1D for double, byte?

1L is long, 1F is float, 1D is double. How about bytes?

long l = 1l;
float f = 1f;
double d = 1d;
// byte b = 1?;

What is the equivalent of bytes? Does it exist?

Solution

No, no suffix can be attached to numeric text to make it a byte

See 3.10 literals. In the Java language specification

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>