从数组(“world”,“girl”,“hello” “boy”,"city","good”}中进行数组元素“city”的查询, 如果能找到 输出该元素的位置
public static void main(String[] args) throws InterruptedException {
String[] arr = new String[]{"world", "girl", "hello", "boy", "city", "good"};
for (int i = 0; i < arr.length; i++) {
if ("city".equals(arr[i])) {
System.out.println("找到city的位置是:" + i);
}
}
}