【发布时间】:2023-04-05 20:55:01
【问题描述】:
我是编程新手。告诉我两者的区别
Integer x= 59; 和 Integer x= new Integer (59);
他们基本上都做同样的事情,我得到了任何一种方式的输出。
public class WrapperClass
{
public static void main(String args[])
{
Integer x= 59; //
byte y= x.byteValue();
System.out.println(y);
}
}
和
public class WrapperClass
{
public static void main(String args[])
{
Integer x = new Integer (10);
byte y= x.byteValue();
System.out.println(y);
}
}
【问题讨论】: