I realize this is a theoretical question, but there are some problems with the code snippet. As in it won't compile or work as expected. 1. The int i in the for loop needs to be initialized. 2. someArray.length should be used rather than someArray[].length. 3. the loop
test should be < rather than greater than since it's using "i++" and assuming i is initialized to 0.
You asked if it were possible to retrieve only the parts of the array that hold values and specifically mention ints. With an array of ints each int in the array is initialized to 0, they all hold values. With arrays of objects such as Integer initialization is to null and you could tell which parts of the array had real values.
give me the entire contents of an array or just the parts of the array that hold values?
additionally if it does give me the entire array, what code would I use to return only the retreive the parts of the array that contain values such as ints?
...
Here I've made the changes I suggested, perhaps this is what you meant.
[ March 10, 2005: Message edited by: Carol Enderlin ]