To create an Integer object in Java is quite easy. Let us learn about the following two ways for this purpose.
Method1
public class Demo { public static void main(String []args) { Integer obj = new Integer("199"); System.out.println(obj); } }
199
Method2 −Now let us see the second way
Public class Demo { public static void main(String []args) { Integer obj = new Integer(99); System.out.println(obj); } }
99