?? exercise5_10.java
字號(hào):
// Exercise5_10.java: Write a method that finds the index of
// the smallest element in an array of integers.
public class Exercise5_10 {
// Main method
public static void main(String[] args) {
int[] list = {1, 2, 4, 5, 10, 100, 2, -22};
System.out.println("The min is " + minIndex(list));
}
public static int minIndex(int[] list) {
int min = list[0];
int minIndex = 0;
for (int i = 1; i < list.length; i++)
if (min > list[i]) {
min = list[i];
minIndex = i;
}
return minIndex;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -