我是编程的新手.告诉我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);
}
}
Run Code Online (Sandbox Code Playgroud)
和
public class WrapperClass
{
public static void main(String args[])
{
Integer x = new Integer (10);
byte y= x.byteValue();
System.out.println(y);
}
}
Run Code Online (Sandbox Code Playgroud) 我试过这样做但是出错了.为什么我不能这样做?
int main()
{
char sweet[5];
sweet = "kova";
printf("My favorite sweet is %s\n", sweet);
return 0;
}
Run Code Online (Sandbox Code Playgroud)