e******r 发帖数: 220 | 1 First create: Activity[] temp = new Activity[100];
after finishing using that temp array, I want create another temp array
for the following purpose.
while(temp.length>0)
that is I want repeatedly to check above condition in while loop, while
each time the contents in temp array are different.
Thanks | c*****t 发帖数: 1879 | 2 no problem
【在 e******r 的大作中提到】 : First create: Activity[] temp = new Activity[100]; : after finishing using that temp array, I want create another temp array : for the following purpose. : while(temp.length>0) : that is I want repeatedly to check above condition in while loop, while : each time the contents in temp array are different. : Thanks
| g*****g 发帖数: 34805 | 3 No problem, but not recommended, most of time it would be anti-pattern.
Maybe ArrayList will fit your usage better.
【在 e******r 的大作中提到】 : First create: Activity[] temp = new Activity[100]; : after finishing using that temp array, I want create another temp array : for the following purpose. : while(temp.length>0) : that is I want repeatedly to check above condition in while loop, while : each time the contents in temp array are different. : Thanks
| A**o 发帖数: 1550 | 4 And since you redefine it every time,
look out for null pointer.
array
while
【在 g*****g 的大作中提到】 : No problem, but not recommended, most of time it would be anti-pattern. : Maybe ArrayList will fit your usage better.
| m******t 发帖数: 2416 | 5 I know it's probably just different terminology, but I just could't help --
you can _reassign_ an array, but you can't _redefine_ it, not with the same
scope.
while
【在 e******r 的大作中提到】 : First create: Activity[] temp = new Activity[100]; : after finishing using that temp array, I want create another temp array : for the following purpose. : while(temp.length>0) : that is I want repeatedly to check above condition in while loop, while : each time the contents in temp array are different. : Thanks
|
|