+ 1

Why isn't this working?

Why is my code producing error and how to correct it while doing the same thing I wanted to do(covering an ArrayList to array)? https://code.sololearn.com/cfzT5YYlTatb/?ref=app

31st Oct 2021, 12:12 PM
Rishi
Rishi - avatar
3 Answers
+ 2
Line 21 : Test[] arr=al.toArray(new Test[0]);
31st Oct 2021, 12:20 PM
Flash
+ 2
Flash okay I guess it's the size of the array. I fixed my code as below: https://code.sololearn.com/ccxQrmG8GBh7/?ref=app Tnx again for your help =)
31st Oct 2021, 1:16 PM
Rishi
Rishi - avatar
+ 1
Flash Tnx, but what does that 0 mean in "new Test[0]"?
31st Oct 2021, 1:14 PM
Rishi
Rishi - avatar