Java Modifying Elements in a foreach

前端 未结 4 1168
迷失自我
迷失自我 2020-12-04 02:18

I\'m learning Java on my own; and therefore the code below has no function other than for learning/testing.

Essentially I\'m trying to modify the elements of an Inte

4条回答
  •  既然无缘
    2020-12-04 02:37

    for (int i = 0; i< copyArray.length; i++) {
        copyArray[i] = new Integer(x /2);
    }
    

    should work.

提交回复
热议问题