Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一种将 Short 转换为 Int 的方法。我试着用
short i = 5; int t = (int) i;
但这不起作用。同样在 Short 函数本身中,我看不到类似 toInt() 函数的东西......
以下代码可以是您问题的(不优雅的)解决方案:
short i = 5; int t = 0; t = t+i;
你看过包装类的“ Short ”吗?