+ 2
Infinite Array? (Java)
Can we make an infinite array in java? If yes, how?
2 ответов
+ 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.