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
6 odpowiedzi
+ 4
no problem 👍
+ 7
Malik . yes you can
int input = 10;
int[]arr = new int[input];
+ 2
You can't change the size of arrays.
But you can change one of "ArrayList".
+ 2
alright thnx
+ 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
0
so i can't make the user decide the array size