【发布时间】:2014-10-03 10:12:21
【问题描述】:
给定一个整数数组和两个整数值,如何交换两个数组值?
我使用的代码是
public class Q1K {
void swapElements(int[] array, int index1, int index2){
int index3= array[index1];
array[index1]=array[index2];
array[index2]= array[index3];
}
}
抱歉,如果我的问题缺少信息/难以理解
【问题讨论】:
-
提供您的输入和预期输出将有助于获得清晰的想法
-
你的问题不清楚。你能谈谈你的期望吗?