Infinite Array? (Java) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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
1 Antwort
+ 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