Java implicit conversion of int to byte

后端 未结 5 1837
难免孤独
难免孤独 2021-01-17 20:45

I am about to start working on something the requires reading bytes and creating strings. The bytes being read represent UTF-16 strings. So just to test things out I wante

5条回答
  •  一整个雨季
    2021-01-17 21:12

    If you use a number without a hint (e.g. 1234L for a long) the compiler assumes an integer. The value 0xffffffff is an integer with value -1 which can be cast to byte without a warning.

提交回复
热议问题