+ 2

Infinite Array? (Java)

Can we make an infinite array in java? If yes, how?

10th Mar 2017, 3:55 PM
Gherardo Carini
Gherardo Carini - avatar
2 Respuestas
+ 11
No. There are collections like ArrayList which can be expanded dynamically, but you would need to init it in an infinite loop to result an array of infinite length. This will cause memory to overflow and lead to an exception.
10th Mar 2017, 4:14 PM
Tashi N
Tashi N - avatar