提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将字符串转换为short
public class Main { public static void main(String[] args) {//nowjava.com - 时代Java Short sObj1 = new Short("100"); System.out.println(sObj1); String str = "100"; Short sObj2 = Short.valueOf(str); System.out.println(sObj2); } }