English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
在Java中创建Integer对象非常容易。为此,让我们了解以下两种方法。
方法1
public class Demo { public static void main(String []args) { Integer obj = new Integer("199"); System.out.println(obj); } }
输出结果
199
方法2-现在让我们看看第二种方法
Public class Demo { public static void main(String []args) { Integer obj = new Integer(99); System.out.println(obj); } }
输出结果
99