int num = new int(); What happens when this line executes?

前端 未结 3 709
北恋
北恋 2021-01-14 04:35

Got to know a new thing today that we can create integers by using new operator as below

int num = new int();

Now I wonder if

3条回答
  •  -上瘾入骨i
    2021-01-14 05:20

    I think, you are looking for

    int num = default(int);
    

    This is also useful when facing compilation error, Unassigned local variable

提交回复
热议问题