Setting Short Value Java

后端 未结 4 647
死守一世寂寞
死守一世寂寞 2020-11-28 11:36

I am writing a little code in J2ME. I have a class with a method setTableId(Short tableId). Now when I try to write setTableId(100) it gives compil

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 12:25

    There is no such thing as a byte or short literal. You need to cast to short using (short)100

提交回复
热议问题