+ 1
How to copy an array integers to another variable?
for example : int var[]={9}; int someCopy = var[0]; // copy value, assume this is a wrong example int newVar=18; var[0]=newVar; // assign newVar to var[0] how to print someCopy but the value of array var before doesn't change?
2 Antworten
+ 2
System.out.print(someCopy[0])
//should print out the value of var before change. should print out 9
+ 1
i'll try it