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.
假设我有一个名为 sales 的 3 行 5 列双精度数组
double [][] sales = new double [3][5];
如何按行号和列号向特定单元格添加值?我正在尝试编写一个程序,询问用户行号,然后读取它,列号,然后读取它,然后将值放入行号和列号,然后将该值添加到特定的行和列用户指定。
在这些特定位置引用数组,记住 Java 中的数组是从零开始的。
如果你想访问第一行第三列的数据,你会写:
sales[0][2] = 12.345;
请执行下列操作。
sales[row-1][column-1]=value;
还要检查行和列是否不超过它们的最大值和最小值。