0

What is the difference between these...

a) int[] arr; b) int[] arr=new int [x]; (where x can be any number) can't we do this, int[3] arr;. ?

2nd Jan 2018, 6:07 PM
Vasista D
Vasista D - avatar
4 Answers
0
With b) you can declare the size.
2nd Jan 2018, 6:13 PM
Lucien
Lucien - avatar
0
can't we just do this int [x] arr;. ?
2nd Jan 2018, 6:16 PM
Vasista D
Vasista D - avatar
0
You can not do int[3] arr; But you can do arr[3] = 2; (4th (0123=4) index of the array =2)
2nd Jan 2018, 6:18 PM
Lucien
Lucien - avatar
0
thanks
3rd Jan 2018, 2:17 AM
Vasista D
Vasista D - avatar