How to specify a constant is a byte or short?

前端 未结 3 1055
轮回少年
轮回少年 2021-01-11 13:01

For the long data type, I can suffix a number with L to make the compiler know it is long. How about byte and short?

As motivation, the following yields a type-mism

3条回答
  •  悲哀的现实
    2021-01-11 13:48

    For example:

    public static final byte CURRENCY_SYMBOL = 26;
    
    public static final short MAX_VALUE = 3276;
    

提交回复
热议问题