Does the for foreach construct in java create a hard or soft copy?

Posted by Doug on Stack Overflow See other posts from Stack Overflow or by Doug
Published on 2010-06-08T23:17:00Z Indexed on 2010/06/08 23:22 UTC
Read the original article Hit count: 172

Filed under:
|
|

Say I have the following piece of java code

ArrayList<Double> myList = new Double[100];
for (Double x : myList)
    x = randomDouble();

Does this actually modify myList or just the dummy variable?

I realize I should just try this code segment out, but I think this is the sort of thing I should be able to google or search for on this site, and several queries so far have turned up nothing useful.

© Stack Overflow or respective owner

Related posts about java

Related posts about variables