I'm a newbie to programming. Tell me the difference between
Integer x= 59;
and Integer x= new Integer (59);
They both do the same thing basically and I'm getting the output either way.
public class WrapperClass
{
public static void main(String args[])
{
Integer x= 59; //
byte y= x.byteValue();
System.out.println(y);
}
}
and
public class WrapperClass
{
public static void main(String args[])
{
Integer x = new Integer (10);
byte y= x.byteValue();
System.out.println(y);
}
}