+ 1

I want to know how to create dynamic array in java without using ArrayList.

Is there any simplest method for dynamically creating arrays without initialization.

18th Jul 2018, 4:30 AM
Prahar pandya
Prahar pandya - avatar
5 ответов
+ 2
without initialization? you can't. but you can use arraycopy method.
18th Jul 2018, 8:15 AM
Tesfa
Tesfa - avatar
+ 1
okay
18th Jul 2018, 2:41 PM
Prahar pandya
Prahar pandya - avatar
+ 1
to creat dynamic array follow the syntax:- data type arrayname[]=new data type[n];
21st Jul 2018, 3:02 AM
Amrit Kumar Sah
Amrit Kumar Sah - avatar
+ 1
Amrit Kumar Sah But we have to define size n.I am not sure about my array and I want dynamically add elements by user input.
21st Jul 2018, 4:35 AM
Prahar pandya
Prahar pandya - avatar
+ 1
I think arraylist is the only way
21st Jul 2018, 4:35 AM
Prahar pandya
Prahar pandya - avatar