英文:
Why is the following an example of a mutative accumulation operation?
问题
根据Java文档,以下是一个变异累积操作。有人可以解释一下什么是变异累积操作,以及它如何应用于以下代码片段吗?
int sum = 0;
for (int x : numbers) {
sum += x;
}
英文:
According to Java docs, the following is a mutative accumulation operation. Can someone please explain what a mutative accumulation operation is and how does it apply to the following piece of code?
int sum = 0;
for (int x : numbers) {
sum += x;
}
答案1
得分: 4
以下是翻译好的内容:
这些术语中每个单词的标准词典定义应该能让您大部分理解。
它是mutative,因为它会改变(更改/修改/等等)变量sum
以得出结果。
它是accumulation,因为数字逐渐相加形成总和。
英文:
The standard dictionary definitions for each of those words in the term should get you most of the way to understanding.
It's mutative because it mutates (changes/alters/ etc) the variable sum
to arrive at the result
It's an accumulation because the numbers are added to form the sum gradually
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论