Java: Declaring a multidimensional array without specifying the size of the array ( eg. new int[10][] )

前端 未结 6 1303
忘掉有多难
忘掉有多难 2021-01-13 09:08

I\'ve been trying to figure out what exactly is happening here. I\'m just trying to figure out what the 2 lines are doing that I\'ve commented on below. I found this program

6条回答
  •  情歌与酒
    2021-01-13 09:21

    it's not lacking, it's basically not setting a specific amount, it isn't required because it can have many fields

    and the second line

    tri[r] = new int[r+1];
    

    is setting all the fields to not null

提交回复
热议问题