由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - java 可不可以反复定义一个数组
相关主题
今天碰到一个面试题一个好用的arrayToString
Java里有没有类似C++的IO重载<<>>?ArrayList and Link list
最近node.js real time web 很火Java runtime array memory layout?
Array of vector, helpHow to check if an element is in an array?
Urgent!Array 能不能用ArrayList作为它的元素?
how to calculate binary in java?Collection return type and web service
an Array questionJava6里面int跟Integer已经实现了自动转换?
Java里有没有象cell array一样的东西问一道关于Vector的题
相关话题的讨论汇总
话题: temp话题: array话题: while话题: activity话题: create
进入Java版参与讨论
1 (共1页)
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

1 (共1页)
进入Java版参与讨论
相关主题
问一道关于Vector的题Urgent!
convert array to blobhow to calculate binary in java?
stringtemplate questionan Array question
array to listJava里有没有象cell array一样的东西
今天碰到一个面试题一个好用的arrayToString
Java里有没有类似C++的IO重载<<>>?ArrayList and Link list
最近node.js real time web 很火Java runtime array memory layout?
Array of vector, helpHow to check if an element is in an array?
相关话题的讨论汇总
话题: temp话题: array话题: while话题: activity话题: create