Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要用一个增加集合中适当整数的语句替换一系列增加七个整数的 if/else-if/else 语句。我有一个初始化的整数数组:
int[] finals={0, 0, 0, 0, 0, 0, 0};
我不知道如何访问和修改列表中不同变量的索引。这是Java顺便说一句。
访问数组中的变量:
int[] finals={1,2,3,4,5,6,7};
finals[0] = 1; finals[1] = 2;