- 博客(2)
- 收藏
- 关注
转载 input.nextLine()另一种用法
1 import java.util.Scanner; 2 3 public class InputException{ 4 public static void main(String[] args){ 5 Scanner input = new Scanner(System.in); 6 boolean a = tr...
2016-08-05 12:13:00 1375
转载 数组元素交换
新建一个数组,并交换它们的第a,b个数组元素。 正确的写法: int[] arr = new int[10]; int temp = arr[a]; arr[a] = arr[b]; arr[b] = temp; 另一种错误的写法(我一开始的想法): int temp = a; a = b; b = temp; 这种写法只交换了数组的下标,并没有改变他们的元素,无论下...
2016-08-04 10:47:00 274
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人