i**p 发帖数: 902 | 1 Can you find problem(s) in this code?
public class TestShort {
static void set(short i) {}
public static void main(String[] args) {
short a = 10;
set(10);
}
}
| o*********r 发帖数: 203 | 2 Java treats 10 as int (32bits), so casting is needed. | b*******s 发帖数: 5216 | 3 没看代码,只看了回复,其实Java不到32bit的会自动promote | i**p 发帖数: 902 | 4 Two shorts there. Need explicit cast for both?
【在 o*********r 的大作中提到】 : Java treats 10 as int (32bits), so casting is needed.
|
|