提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
创建整数对象
public class Main { public static void main(String[] args) { /* from NowJava.com */ //1. Create an Integer object from int Integer intObj1 = new Integer(10); /* 2. Create and Integer object from String. */ Integer intObj2 = new Integer("10"); //print value of Integer objects System.out.println(intObj1); System.out.println(intObj2); } }