0

how can we control our array size in java? In C we used to use a pointer and dynamic memory allocation.

Java / controlling array size

9th Apr 2018, 2:46 PM
Malik .
Malik . - avatar
6 Réponses
+ 4
no problem 👍
9th Apr 2018, 3:04 PM
D_Stark
D_Stark - avatar
+ 7
Malik . yes you can int input = 10; int[]arr = new int[input];
9th Apr 2018, 3:01 PM
D_Stark
D_Stark - avatar
+ 2
You can't change the size of arrays. But you can change one of "ArrayList".
9th Apr 2018, 2:57 PM
Disvolviĝo;
Disvolviĝo; - avatar
+ 2
alright thnx
9th Apr 2018, 3:03 PM
Malik .
Malik . - avatar
+ 1
there are so many way to do that.. int y[]; y=new int[5]; Or int y[]={10,29,30} This is also a way to declared an array like.. public static void main(String...a) this is a array of string
9th Apr 2018, 3:14 PM
Arun Tomar
Arun Tomar - avatar
0
so i can't make the user decide the array size
9th Apr 2018, 2:59 PM
Malik .
Malik . - avatar