gpt4 book ai didi

java - Java 中的类型提升

转载 作者:太空狗 更新时间:2023-10-29 22:50:10 25 4
gpt4 key购买 nike

<分区>

我对以下 Java 语句有疑问:

byte b = 10;
byte r = (byte) (b * b); // Giving correct result
byte r = (byte) b * b; // Giving error " POSSIBLE LOSS OF PRECISION"

为什么必须给 b * b 加上括号?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com