Link to home
Create AccountLog in
Avatar of bbvic
bbvic

asked on

array

String [] test ="";
String test1="test1";
String test2="test2";
String test3="test3";
test = {test1,test2,test3};

is it correct?
Avatar of hell_no_techno_tim
hell_no_techno_tim

no i dont think so cos your filling the array with pointers to strings.

declare it like this

String[] flintstones = {"Fred", "Wilma", "Pebbles"};

test1 would be a pointer of type string that points to the memory location where t is stored, you would have to do a strcpy to fill the array and you would need to use free to allocate some memory to store the array.

or am i talking in C !!
ASKER CERTIFIED SOLUTION
Avatar of elfe69
elfe69
Flag of Switzerland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer