I am new to learning Java, and I was told to create object variables like this:
Integer a = new Integer(2);
Instead of like this:
Integer a = 2;
Can someone explain why is creating object variables the 2nd way bad? edit: I am adding this here cause I am getting mixed answers Which one am I supposed to use and when?